- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在底部有一个带有四个按钮的 RadioGroup,用作我的应用程序的导航(我知道这对于 Android 应用程序来说是非标准的,但这是客户想要的)。它应该是这样的:
这在我的 Nexus 7 上看起来不错,在我的 IDE 中的模拟器和预览版中看起来也不错。然而,当我将它加载到 Galaxy S Note 2 上时,它是这样的:
图像被截断了,因为它们似乎被“移动”到这个特定设备的右边。我有一种感觉,在较小的设备上,它会更加倾斜和截断。当我手动执行大约 35dp 的负左边距时,它实际上看起来很完美并且它们对齐得很好(但当然该解决方案不适用于其他设备)。
奇怪的是,我的代码似乎并没有做任何特别的事情,而且看起来非常简单。仅供引用,即使我将其更改为只有三个按钮,它仍然将按钮向右移动,而不是真正将它们居中(尽管只有 3 个按钮时它们不会被截断)。我就是不明白为什么会这样,不管我尝试了多少调整重力、重量,甚至交换图像的东西。我目前只为这些使用/xhdpi 图像,每个图像的大小约为 130x130。
作为引用,这里是我的布局文件中 RadioGroup 的底层代码(它在 RelativeLayout 中):
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tab_radio_group"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:background="@drawable/navigation_base"
android:paddingTop="15dp">
<RadioButton
android:id="@+id/button_scan"
style="@style/navbar_button"
android:drawableTop="@drawable/scan"/>
<RadioButton
android:id="@+id/button_view_order"
style="@style/navbar_button"
android:drawableTop="@drawable/view_order"/>
<RadioButton
android:id="@+id/button_complete_order"
style="@style/navbar_button"
android:drawableTop="@drawable/complete_order"/>
<RadioButton
android:id="@+id/button_settings"
style="@style/navbar_button"
android:drawableTop="@drawable/settings"/>
</RadioGroup>
这是 navbar_button 的样式元素:
<style name="navbar_button">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:button">@null</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:layout_weight">1</item>
<item name="android:textSize">12dp</item>
</style>
我可能在这里遗漏了一些明显的东西,但是对此有什么想法吗?提前致谢!
最佳答案
为了解决这个问题,我最终不得不放弃 RadioGroup 和 RadioButtons,转而使用带有按钮的简单线性布局。它仍然是相对简单的代码,它只涉及稍微更改 Java 代码以使用普通按钮而不是 RadioButton。如果有兴趣,这是更改后的布局:
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tab_radio_group"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:background="@drawable/navigation_base"
android:paddingTop="15dp">
<Button
android:id="@+id/button_scan"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:drawableTop="@drawable/scan"/>
<Button
android:id="@+id/button_view_order"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:drawableTop="@drawable/view_order"/>
<Button
android:id="@+id/button_complete_order"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:drawableTop="@drawable/complete_order"/>
<Button
android:id="@+id/button_settings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:drawableTop="@drawable/settings"/>
</LinearLayout>
关于android - RadioGroup 按钮图像被截断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17128455/
我有一个 1850-2005 年月地表气温的 netCDF 文件。如何在 unix 中截断文件,以便新文件的时间维度从 1855 年到 2005 年?反之亦然,截断文件,使其改为 1850-2000?
我收到此错误 Bulk load data conversion error (truncation) for row 1, column 12 (is_download) 这是 csv...它只有一
我有一个列表,它是电子邮件正文,每行末尾都有一个日期和时间戳。邮票的格式是一致的,所以可以从右边计算表达式。以下是示例数据: Dear Volunteer2018-05-21 19:59:15 You
我正在使用内置 truncatewords_html Django 的过滤器,它在最后添加了“...”,相反,我想用“查看更多”链接替换它。 我怎样才能做到这一点? 最佳答案 最好编写自己的过滤器。您
我正在使用 SQL 加载器将我的数据加载到数据库中。 在插入数据之前,我需要删除表中的现有数据: options(skip=1,load=250000,errors=0,ROWS=30000,BIND
我正在尝试掌握消息队列的窍门。由于某种原因,当显示我在控制台中输入的消息时,字符串有时会被截断或更改。有谁知道为什么会发生这种情况? void *readFromQueue() { int r
我正在使用mediawiki API(例如http://en.wikipedia.org/w/api.php),我希望能够“截断”mysql表以便重置本地安装,同时保留一些表(用户,?...) 。SQ
想要截断一个存在的表: IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'mytable') TRUNCATE
我正在实现一个使用 Python Numpy 包的程序。我正在尝试修改数组的元素,以便我只需采用 elem[i][j] 并将其设置为 elem[i][j]/10。但是,我不断收到某种截断,其中元素在操
我有一个 64 位 long int,其中包含一些位域。我需要将存储在第二个和第三个字节中的 16 位带符号整数添加到一个 32 位值中。我正在使用这样的东西: u32 Function( s32 v
我有这样的文字:“我的文字是 blabla blabla, lala lala”。 我希望在我的 UILabel 中有这样的文本:“My text is ...lala”。 如何配置我的 UILabe
Umbraco Truncate 似乎不适合我,当我使用正确的代码(根据互联网)时,它会不断出错。我不知道它有什么问题。 错误代码: Compiler Error Message: CS1502: T
早些时候,我是使用 JS 动态地完成它的。但是我们遇到了一些性能问题,因为我们必须提供一个替代选项。 我现在使用文本溢出样式截断选项卡名称上的长文本。 但我有一个小问题,如果有人能解决的话 目前这是我
使用Rspec时截断、事务和删除数据库策略有什么区别?我找不到任何资源来解释这一点。我阅读了 Database Cleaner 自述文件,但它没有解释它们各自的作用。 为什么我们必须对 capybar
当然, 尚有诸位前辈也曾把以上三种方案结合一二, 以达到更广泛的适应度. 不过, 这厢先前在网路上搜索许久, 却未曾寻到三种方案合为一体的尝试, 于是只好自己动手写一下了:) 没有dem
有没有办法截断HSQLDB中的所有表? 如果这不可能,是否有任何方法可以级联删除具有外键引用的表? 最佳答案 可以截断模式中的所有表: 截断模式并提交 此命令有一些选项在指南中有描述: http://
我有一个要截断的时间戳。我正在使用 trunc oracle中的函数。这似乎做了我想要的但是从文档中它应该只接受日期而不是时间戳 select TRUNC(TO_DATE('22-AUG-13'),
我读到一旦你耗尽了一个节点,你就可以删除文件然后重新启动。它工作正常, 但我只是通过排空所有节点,关闭整个集群,删除文件并重新启动来尝试它。 如果我一次只重启一个节点会怎样?据我了解有风险 重新启动的
我想截断 d3 中超过预定义限制的文本。 我不知道该怎么做。 这是我现在所拥有的: node.append("text") .attr("dx", 20) .attr("dy", ".20
嗨 Guyz 我有一个固定宽度的 WPF TextBlock 说 100 ,如果字符串不适合宽度,则最后一个字符总是被截断,因为所有字符的大小都不相同。我不想剪切字符而是我想从那里跳过文本并只显示没有
我是一名优秀的程序员,十分优秀!