请问一下每个页面都有一个底部布局,怎么做 有些软件的底部都是相同的按钮菜单,请问怎么做的不可能每个xml里面添加吧,维护很麻烦的.或者用自定义空间吗,然后每个界面添加? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用android tabhost,把tab移到底部 用你的activity类继承TabActivity类,给一些参考代码: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代码:<?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" />把公共的部分引用过来。 android如何能定时下载东西? NDK里面socket connect总是返回-1 android条码扫描器Camera问题 求推荐几本关于andriod入门书 NFC接受不能检测到其他tag andriod中怎样实现跳转?下面的代码哪错了? SQLite数据库查询错误 如何在myeclipse2013上开发安卓应用,环境怎么配置? WebView 只在屏幕左半边显示网页内容的问题 求教ndk编译问题,关于gles2的 如何实时上传坐标信息(运动轨迹) 既然: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" />
把公共的部分引用过来。