我是靠谱客的博主 洁净唇彩,这篇文章主要介绍Android(4)布局方法、px/dp/dpi/ps/内边距与外边距,现在分享给大家,希望可以做个参考。

一:
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(4)布局方法、px/dp/dpi/ps/内边距与外边距的全部内容,更多相关Android(4)布局方法、px/dp/dpi/ps/内边距与外边距内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(121)

评论列表共有 0 条评论

立即
投稿
返回
顶部