Android布局的小窍门?
2012-07-18 21:26
1306 查看
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
我要实现如下的效果:
我只想用一个RelativeLayout来实现,不想嵌套,因为xml嵌套的越多我们的程序的效率越低…解析xml多一层就慢了不少…最苦逼的是又下角的素材全透明而且很小很小…妹的…
这样我就没办法调整图片和父控件底部的距离了有木有…
但是我想到了一个更加苦逼的办法…
我在这下面又加了一个TextView来占地方…让这个TextView宽度fill_parent,高度wrap_content…
不给他设置内容…因为TextView默认背景是透明的…所以达到了想要的效果…
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#f9f5f2" > <TextView android:id="@+id/xinwen" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="3dip" android:layout_marginLeft="10dip" android:layout_marginTop="6dip" android:text="全球新闻" android:textSize="16dip" /> <TextView android:id="@+id/header" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/xinwen" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:text="国际在线 专稿:据英国《每日电 讯报》7月16日报道,法国社会党政府即将执行的增税计划迫使大批富豪变卖家财,逃往“对富人友好的国家”,比如英国和瑞士等。" android:textSize="11dip" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/salonbookicon" android:layout_alignParentLeft="true" android:layout_marginLeft="10dip" android:paddingBottom="3dip" android:text="2012年12月12日" android:textColor="#fb4b4d" android:textSize="10dip" /> <ImageView android:id="@+id/salonbookicon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_below="@+id/header" android:layout_marginRight="14dip" android:layout_marginTop="15dip" android:background="@drawable/read_more" /> <TextView android:layout_below="@+id/salonbookicon" android:layout_width="fill_parent" android:textSize="7dip" android:layout_height="wrap_content" /> </RelativeLayout>
相关文章推荐
- Android布局方式(AbsoluteLayout)学习
- Android性能优化(布局优化)
- Android中的线性布局(LinearLayout)
- Android布局文件绘制原理学习总结 -- measure/layout/draw
- android布局优化-merge
- 【腾讯Bugly干货分享】Android动态布局入门及NinePatchChunk解密
- android 在布局中动态添加控件
- Android 四大布局总结
- Android 四大组件+五大布局
- Android FoldingLayout 折叠布局 原理及实现(二)
- Android 搜索界面提示语 根据不同字的个数实现不规则的 弹幕效果 流式布局,热门标签
- Android开发中 软件盘将布局遮住的问题
- 线性布局(LinearLayout)——Mars Android开发视频之第一季第十二集(重)
- android 基础—常用布局
- Android最佳性能实践——布局优化技巧
- Android中View测量、布局及绘制原理
- Android 正确设置控件布局参数
- android面试细节之布局属性细节,非你莫属!
- Android布局动画
- Android界面布局基本知识简述