您的位置:首页 > 移动开发 > Android开发

Android(4)布局方法、px/dp/dpi/ps/内边距与外边距

2015-10-24 22:36 633 查看
一:

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



控件内容与控件边缘的边距叫内边距

控件边缘与其他控件的距离叫外边距



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: