有些软件的底部都是相同的按钮菜单,请问怎么做的
不可能每个xml里面添加吧,维护很麻烦的.
或者用自定义空间吗,然后每个界面添加?

解决方案 »

  1.   

    用android tabhost,把tab移到底部
      

  2.   

    用你的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
      

  3.   

    在贴一个对应的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>
      

  4.   


    比如写个bottom.xml
    然后<include layout="@layout/bonttom" />
    把公共的部分引用过来。