我有一個有RadioGroup和單選按鈕的佈局。它的工作原理,但在顯示方面存在問題。我已經分享了下面的截圖。Android - 無線組按鈕文本位置
的Android 4.2.1 - 4.65英寸
平板的Android 2.2 - 7英寸
的Android 4.1.2 - 5.5英寸
從bottorbar代碼佈局
從主要佈局<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:padding="3dp" android:gravity="center"
android:background="@drawable/bottom"
>
<RadioGroup
android:id="@+id/radioTur"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:measureWithLargestChild="true"
android:layout_gravity="center_vertical"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/rad_anasayfa"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:button="@null"
android:gravity="center"
android:drawableTop="@drawable/anasayfabutton"
android:textColor="@color/White"
android:onClick="Anasayfa_TIKLA"
android:text="Anasayfa" >
</RadioButton>
<RadioButton
android:id="@+id/rad_haber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@null"
android:gravity="center"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableTop="@drawable/haberlerbutton"
android:textColor="@color/White"
android:onClick="Haber_TIKLA"
android:text="Haberler" >
</RadioButton>
<RadioButton
android:id="@+id/rad_duyuru"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@null"
android:gravity="center"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableTop="@drawable/duyurubutton"
android:textColor="@color/White"
android:onClick="Duyuru_TIKLA"
android:text="Duyurular" >
</RadioButton>
<RadioButton
android:id="@+id/rad_yemek"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@null"
android:gravity="center"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableTop="@drawable/yemekbutton"
android:textColor="@color/White"
android:onClick="Yemek_TIKLA"
android:text="Yemek" >
</RadioButton>
<RadioButton
android:id="@+id/rad_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@null"
android:gravity="center"
android:layout_weight="1"
android:onClick="Arama_TIKLA"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableTop="@drawable/search_icon"
android:textColor="@color/White"
android:text="Arama" >
</RadioButton>
</RadioGroup>
</LinearLayout>
代碼
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/AnaLayout"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/linearLayout1"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" >
<include
android:id="@+id/cell1"
android:layout_height="wrap_content"
layout="@layout/bottombar"
/>
</LinearLayout>
</RelativeLayout>
我已經工作了幾days.I不明白的問題。有人能幫我嗎 ?
我的圖標
對於RadioButton,使用android:layout_width =「wrap_content」。 –
感謝您的快速評論,但它無法正常工作。 –
@CanerBalım看看我的答案。 – GrIsHu