android 4中的android RadioButton问题 [英] android RadioButton issue in android 4

查看:30
本文介绍了android 4中的android RadioButton问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的应用程序.屏幕是在 RelativeLayout 内构建的.我还有LinearLayout(s),其中一个显示 2 个 RadioButton(s),如下所示:

I have a simple application. The screen is build inside a RelativeLayout. I have more LinearLayout(s), one of them shows the 2 RadioButton(s), like this:

        <LinearLayout android:layout_width="match_parent" android:layout_height="fill_parent"
            android:padding="3dp" android:gravity="center">
            <RadioGroup android:id="@+id/rgrDayToReport" 
                android:orientation="horizontal" 
                android:layout_width="wrap_content" android:layout_height="wrap_content">
                <RadioButton android:checked="true" android:id="@+id/rbtnToday"
                    android:layout_width="wrap_content" android:layout_height="wrap_content"

                    android:text="@string/radioTodayText"/>
                <RadioButton  android:id="@+id/rbtnYesterday"
                    android:layout_width="wrap_content" android:layout_height="wrap_content"

                    android:text="@string/radioYesterdayText"/>
            </RadioGroup>
        </LinearLayout>

此面板在除三星 Galaxy s3 之外的任何设备(正如我所做的测试)中都能正确呈现.在此设备上(仅在此设备上)屏幕如下所示:

This panel render correctly in any device (as I did tests) except Samsung Galaxy s3. On this device (only on this device) the screen looks like this:

我应该如何解决这个问题?

推荐答案

我遇到了同样的问题.我通过不在 RadioButtons 和 CheckBoxes 上设置 paddingLeft 解决了这个问题 - 保留默认值.paddingLeft 是从所有手机上的可绘制对象和 Galaxy S3 的左角开始计算的.设置 background 也会在 Galaxy S3 上造成同样的错误.保留默认值后,它现在可以在任何地方使用.

I was experiencing the same problem. I have solved this by NOT setting paddingLeft on RadioButtons and CheckBoxes - leaving default value. paddingLeft was counted from the drawable on all phones and from left corner on Galaxy S3. Also setting background was causing the same bug on Galaxy S3. After leaving default values it's now usable everywhere.

这篇关于android 4中的android RadioButton问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆