Android(4)布局方法、px/dp/dpi/ps/内边距与外边距
2015-10-24 22:36
633 查看
一:
LinearLayout
RelativeLayout
二:
ListView
GridView
例子:
注意此时第二个控件就被挤出屏幕外了
px/dpi/dp/ps 概念
px 像素
dpi 每英寸含像素个数
dip(dp)与设备无关像素
sp
控件内容与控件边缘的边距叫内边距
控件边缘与其他控件的距离叫外边距
LinearLayout
RelativeLayout
二:
ListView
GridView
例子:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <TextView android:id="@+id/textview" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="the first textview"/> <TextView android:id="@+id/textview2" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="the second textview"/> </LinearLayout>
注意此时第二个控件就被挤出屏幕外了
px/dpi/dp/ps 概念
px 像素
dpi 每英寸含像素个数
dip(dp)与设备无关像素
sp
控件内容与控件边缘的边距叫内边距
控件边缘与其他控件的距离叫外边距
相关文章推荐
- Android 工程目录结构简介
- Android 测试类型
- Android性能专项测试
- Android静态代码检查
- Android开发之接收系统广播消息
- Android静态代码检查
- Android编码规范04
- 【转】Android根据分辨率进行单位转换-(dp,sp转像素px)
- android XML解析之DOM解析方式
- android 编译系统
- 《第一行代码Android》学习日记9
- 自学JAVA编程及android编程第一个月总结及下一个月思路
- Android学习笔记——国际化
- Android常用组件
- Android 学习笔记之Volley开源框架解析(五)
- 《第一行代码Android》学习日记8
- Android ANR
- Caused by: android.os.NetworkOnMainThreadException
- Android下HelloWorld项目的R.java文件介绍
- Android PopupWindow的使用和分析