布局时候出现的一个小错误
来源:互联网 发布:快易数据恢复可靠吗 编辑:程序博客网 时间:2024/05/16 18:33
需要实现的功能是底部的菜单布局
生效前,背景设置就生效了。
布局的代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <RadioGroup android:id="@+id/activity_main_botton_radiogroup" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RadioButton android:id="@+id/activity_main_botton_radiobutton_nearby" android:layout_width="0dp" android:layout_height="55dp" android:layout_weight="1.0" android:background="@drawable/botton_btn" android:button="@null" android:drawableTop="@drawable/botton_top_nearby_btn" android:gravity="center" android:text="@string/botton_fujin" /> <RadioButton android:id="@+id/activity_main_botton_radiobutton_search" android:layout_width="0dp" android:layout_height="55dp" android:layout_weight="1.0" android:background="@drawable/botton_btn" android:button="@null" android:drawableTop="@drawable/botton_top_search_btn" android:gravity="center" android:text="@string/botton_sousuo" /> <RadioButton android:id="@+id/activity_main_botton_radiobutton_favorite" android:layout_width="0dp" android:layout_height="55dp" android:layout_weight="1.0" android:background="@drawable/botton_btn" android:button="@null" android:drawableTop="@drawable/botton_top_fav_btn" android:gravity="center" android:text="@string/botton_shoucang" /> <RadioButton android:id="@+id/activity_main_botton_radiobutton_more" android:layout_width="0dp" android:layout_height="55dp" android:layout_weight="1.0" android:background="@drawable/botton_btn" android:button="@null" android:drawableTop="@drawable/botton_top_more_btn" android:gravity="center" android:text="@string/botton_gengduo" /> </RadioGroup></LinearLayout>以上这份代码是经过修改后正确的。
之前出现了一个问题,问题效果如下(两个按钮所占的空间位置不一样大):
明显的可以看到第二个button比第一个button占的位置要小,后面两个button也比第一个小。
仔细排查发现,是由于代码
android:layout_width="wrap_content"出问题。初步断定是由于背景图片过大,在代码
android:layout_weight="1.0"
生效前,背景设置就生效了。
所以将控件的宽度设置为0dp即可:
android:layout_width="0dp"
- 布局时候出现的一个小错误
- 开启vm的时候出现出现的小错误
- 线性布局上的一个小错误
- 在做Urlwrite+struts2.0的一个小示例的时候老是出现找不到action的情况404错误
- 点击Cell的时候 出现一个 小对勾的( 确定UITableViewCell AccessoryCheckmark唯一性)
- 配置spring的时候出现的错误
- atl写的程序,客户调用的时候出现一个联结错误
- 使用DataKeys的时候,出现 ArgumentOutOfRangeException错误
- 使用response Redirect时候出现的错误
- 网站发布的时候出现错误
- Servlet部署的时候出现404错误
- myeclipse 部署tomcat的时候出现错误
- make menuconfig 的时候出现错误
- makeimg 的时候出现如下错误
- 打开Dreamweaver的时候出现错误
- ios测试的时候出现错误
- AndroidStudio打包的时候出现错误
- 在使用一个控件的时候出现Layout cycle detected. Layout could not complete 错误。
- Java-Jsp中内置对象[1]
- 【转载】python26高级[读写Excel]
- hibernate 数据库类型 date没有时分秒解决
- DevSuite产品实现敏捷测试 ( QA Test Co-owner Event)
- C语言位运算符
- 布局时候出现的一个小错误
- ThinkPad t430不能进入BIOS
- QT布局管理程序实现的学习及 QTextEdit编辑
- java反射机制学习
- 在ubuntu12.04上编译并安装kernel2.6.39.4
- storm安装部署
- 基于物品的协同过滤推荐算法——读“Item-Based Collaborative Filtering Recommendation Algorithms” .
- Visual Studio下使用jQuery的10个技巧
- Java Big Endian&Little Endian