<!---首先添加滚动视图---->
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:context=".RadioButton2Activity" >
<!---添加RadioGroup---->
<!-- 去掉 RadioButton 的默认圆圈和checkBox 的默认方块。android:button="@null" -->
<!-- 带文字和图片的button :android:drawableTop="@drawable/playd"-->
<RadioGroup
android:id="@+id/RadioGroup2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/rb1"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_2"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_haobang"
android:gravity="center"
android:text="首页" />
<RadioButton
android:id="@+id/rb2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_3"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_haoxihuan"
android:gravity="center"
android:text="新闻" />
<RadioButton
android:id="@+id/rb3"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_4"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_holdzhu"
android:gravity="center"
android:text="天气" />
<RadioButton
android:id="@+id/rb5"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_4"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_holdzhu"
android:gravity="center"
android:text="天气" />
<RadioButton
android:id="@+id/rb4"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_5"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_jiekexun"
android:gravity="center"
android:text="地图" />
</RadioGroup>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:context=".RadioButton2Activity" >
<!---添加RadioGroup---->
<!-- 去掉 RadioButton 的默认圆圈和checkBox 的默认方块。android:button="@null" -->
<!-- 带文字和图片的button :android:drawableTop="@drawable/playd"-->
<RadioGroup
android:id="@+id/RadioGroup2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/rb1"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_2"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_haobang"
android:gravity="center"
android:text="首页" />
<RadioButton
android:id="@+id/rb2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_3"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_haoxihuan"
android:gravity="center"
android:text="新闻" />
<RadioButton
android:id="@+id/rb3"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_4"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_holdzhu"
android:gravity="center"
android:text="天气" />
<RadioButton
android:id="@+id/rb5"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_4"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_holdzhu"
android:gravity="center"
android:text="天气" />
<RadioButton
android:id="@+id/rb4"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/color_5"
android:button="@null"
android:checked="true"
android:clickable="true"
android:drawableTop="@drawable/lxh_jiekexun"
android:gravity="center"
android:text="地图" />
</RadioGroup>
</HorizontalScrollView>
得到的效果图如下
向右滑动后得到