android galary 底部Tab的两种实现方式
来源:互联网 发布:php 冒泡排序算法 编辑:程序博客网 时间:2024/04/27 15:06
http://liangruijun.blog.51cto.com/3061169/747173
- <?xml version="1.0" encoding="utf-8"?>
- <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@android:id/tabhost"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <FrameLayout
- android:id="@android:id/tabcontent"
- android:layout_width="fill_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- >
- <TextView
- android:id="@+id/view1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="nihao"
- />
- <TextView
- android:id="@+id/view2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="nihenhao"
- />
- </FrameLayout>
- <TabWidget
- android:id="@android:id/tabs"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- />
- </LinearLayout>
- </TabHost>
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/hello"
- />
- </LinearLayout>
- package com.lingdududu.test;
- import android.app.TabActivity;
- import android.os.Bundle;
- import android.widget.TabHost;
- public class TestHostActivity extends TabActivity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.tabs);
- TabHost tabhost = getTabHost();
- tabhost.addTab(tabhost.newTabSpec("111").setIndicator("view1").setContent(R.id.view1));
- tabhost.addTab(tabhost.newTabSpec("222").setIndicator("view2").setContent(R.id.view2));
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <TabHost
- android:id="@+id/tabhost"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <FrameLayout
- android:id="@android:id/tabcontent"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:paddingBottom="62px"
- >
- <TextView
- android:id="@+id/tab1"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:text="这是TabOne"
- />
- <TextView
- android:id="@+id/tab2"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:text="这是TabTwo"/>
- </FrameLayout>
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <TabWidget
- android:id="@android:id/tabs"
- android:layout_alignParentBottom="true"
- android:layout_width="fill_parent"
- android:layout_height="65.0px"
- android:background="@drawable/tab_bg"
- />
- </RelativeLayout>
- </TabHost>
- </LinearLayout>
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/hello"
- />
- </LinearLayout>
- package com.lingdududu.test;
- import android.app.Activity;
- import android.os.Bundle;
- import android.widget.TabHost;
- public class TabHostActivity extends Activity {
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.tabs);
- TabHost tabs=(TabHost)findViewById(R.id.tabhost);
- tabs.setup();
- TabHost.TabSpec spec=tabs.newTabSpec("tag1");
- spec.setContent(R.id.tab1);
- spec.setIndicator("TabOne");
- tabs.addTab(spec);
- spec=tabs.newTabSpec("tag2");
- spec.setContent(R.id.tab2);
- spec.setIndicator("TabTwo");
- tabs.addTab(spec);
- tabs.setCurrentTab(0);
- }
- }
- android galary 底部Tab的两种实现方式
- Android开发教程:底部Tab的两种实现方式
- Android 底部菜单栏Tab功能的几种实现方式
- Android 底部菜单栏Tab功能的几种实现方式
- Android底部菜单的两种实现方式
- 实现底部栏(tab)功能的几种方式
- android实现界面底部的tab
- Android中两种实现底部Tab的方法
- android实现界面底部的tab
- Android--RadioGroup和Tablayout两种实现底部导航的方式详解
- android ScrollView判断滑动到底部的两种方式
- android两种Tab分页的方式:TabActivity和ActivityGroup
- Android实现底部菜单Tab
- Android底部弹框的两种实现(总结)
- 网页底部固定的两种方式
- 底部Tab的实现(tabhost)
- Android 位于底部的Tab
- 【Android 新浪微博】--底部Tab的实现
- 我所理解的设计模式(C++实现)——访问者模式(Visitor Pattern)
- jdbc、Hibernate、ibatis的区别
- SPOJ GSS5 Can you answer these queries V
- scala中的元组(Tuple)
- PGSQL 重建索引 函数
- android galary 底部Tab的两种实现方式
- JavaScript 开发者经常忽略或误用的 7 个基础知识点
- 此文胜过你听三年的培训课,最少省十万
- NVIDIA CUDA认证
- LR问题与解决方法.doc
- gridview嵌套实例
- tomcat在linux中命令
- 安装VMware10 msi failed(原因为与avast冲突)
- 华为的JAVA面试题及答案(部分)