2014-12-05 34 views
1

在我的Android应用程序,我有被这样的水平风格的三个单选按钮,设置水平风格的单选按钮的大小,即适合所有的屏幕尺寸

enter image description here

的问题是,当我在有小屏幕的android手机上运行我的应用程序,其中一个单选按钮掉线。我如何设置这些广播文字的特定尺寸,以便他们可以根据手机屏幕进行调整?

这是我的xml代码。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@drawable/remedy1"> 
      <LinearLayout android:id="@+id/linearLayout1" 
       android:layout_height="wrap_content" android:orientation="horizontal" 
       android:layout_width="fill_parent"> 
       <RadioGroup 
        android:id="@+id/selection" 
        android:layout_width="fill_parent" 
        android:weightSum="3" 
        android:layout_height="fill_parent" android:orientation="horizontal" 
        android:layout_marginTop="10dp"> 
     <RadioButton 

       android:layout_width="fill_parent" 
       android:layout_weight="1" 
       android:layout_height="wrap_content" 
       android:textSize="18sp" 
       android:textStyle="bold" 
       android:textColor="#ffffff" 
       android:text="Sensation" 
       android:id="@+id/sens" android:checked="true" 
       android:button="@drawable/button_radio"/> 
     <RadioButton 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="Location" 
       android:textSize="18sp" 
       android:textStyle="bold" 
       android:textColor="#ffffff" 
       android:layout_weight="1" 
       android:id="@+id/loc" android:checked="false" 
       android:button="@drawable/button_radio"/> 
     <RadioButton 
       android:layout_width="fill_parent" 
       android:layout_weight="1" 
       android:layout_height="wrap_content" 
       android:text="Modalation" 
       android:textSize="18sp" 
       android:textStyle="bold" 
       android:textColor="#ffffff" 
       android:id="@+id/mod" android:checked="false" 
       android:button="@drawable/button_radio"/> 
    </RadioGroup> 

      </LinearLayout> 

回答

0

这可能是因为您只为所有屏幕大小和密度提供了一个布局!

你能做什么?

创建你的资源项目的文件夹:

res-small 
res-medium 
res-large... 

并把您的自定义布局在

这将提供最佳的布局经验,为您的用户和Android将选择在最佳的布局。特定设备!希望能帮助到你!

了解更多关于 http://developer.android.com/guide/practices/screens_support.html

+0

非常感谢您的信息! :) – Yamna 2014-12-05 18:18:55

+0

@yamna欢迎您;) – Mike 2014-12-05 18:20:49

相关问题