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问题


基础教程推荐
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01