android RadioButton issue in android 4(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问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:android 4中的android RadioButton问题
基础教程推荐
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iOS4 创建后台定时器 2022-01-01
