有些软件的底部都是相同的按钮菜单,请问怎么做的
不可能每个xml里面添加吧,维护很麻烦的.
或者用自定义空间吗,然后每个界面添加?
不可能每个xml里面添加吧,维护很麻烦的.
或者用自定义空间吗,然后每个界面添加?
解决方案 »
- 怎么做出这种效果的下拉框 ???
- style.xml里的@+id在R.java里没有生成
- 请问android2.3.3系统,如何完全退出程序!
- 求助~~有谁知道这种布局怎么实现吗?
- android的"系统设置"用的什么组件
- Android ListView 怎样刷新效率高,而又不影响用户体验!
- 求一个简单布局:右边三个按钮并排靠右,左边一个输入框填满其他空间,谢谢
- Android短彩信数据库mmssms.db数据库中的raw表存放的是什么数据,用作何用?
- 如何启动另外一个程序的BroadcastRecevier?
- 关于Genymotion启动出错的,求各路大神帮忙看一下
- 如何实时上传坐标信息(运动轨迹)
- 既然:Android禁止其他子线程来更新由UI thread创建的试图
TabHost tabHost=getTabHost();//获得tabhost
//设置三个选项卡
tabHost.addTab(tabHost.newTabSpec("1").setIndicator("第一个activity")
.setContent(new Intent(this, A.class)));
tabHost.addTab(tabHost.newTabSpec("2").setIndicator("第二个activity")
.setContent(new Intent(this,B.class)));
tabHost.addTab(tabHost.newTabSpec("3").setIndicator("第三个activity").setContent(new Intent(this, C.class)));
...
tabHost.setCurrentTab(0);//设置当前默认显示第一个选显卡
...
tabHost.setCurrentTabByTag("nearArea");//通过该语句,可以切换其他的activity
<?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:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0.0dip"
android:layout_weight="1.0" /> <TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.0"
android:visibility="gone" /> <RadioGroup
android:id="@+id/main_radio"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#393839"
android:gravity="center_vertical"
android:orientation="horizontal" > <RadioButton
android:id="@+id/nearArea"
style="@style/main_tab_bottom"
android:drawableTop="@drawable/tab_home_normal"
android:paddingBottom="10dip"
android:tag="radio_button0"
android:text="1"
android:textSize="16dip" /> <RadioButton
android:id="@+id/findCoupon"
style="@style/main_tab_bottom"
android:drawableTop="@drawable/tab_home_normal"
android:paddingBottom="10dip"
android:tag="radio_button1"
android:text="2"
android:textSize="16dip" /> <RadioButton
android:id="@+id/hotCoupon"
style="@style/main_tab_bottom"
android:drawableTop="@drawable/tab_home_normal"
android:paddingBottom="10dip"
android:tag="radio_button2"
android:text="3"
android:textSize="16dip" /> <RadioButton
android:id="@+id/pocket"
style="@style/main_tab_bottom"
android:drawableTop="@drawable/tab_home_normal"
android:paddingBottom="10dip"
android:tag="radio_button3"
android:text="4"
android:textSize="16dip" /> <RadioButton
android:id="@+id/more"
style="@style/main_tab_bottom"
android:drawableTop="@drawable/tab_home_normal"
android:paddingBottom="10dip"
android:tag="radio_button4"
android:text="5"
android:textSize="16dip" />
</RadioGroup>
</LinearLayout></TabHost>
比如写个bottom.xml
然后<include layout="@layout/bonttom" />
把公共的部分引用过来。