Android--布局方式(LinearLayout)学习
16lz
2022-06-06
线性布局是一个视图组,它所有的子视图都在一个方向对齐,水平或者垂直。
你可以指定布局的方向通过android:orientation 属性。、
Tips: 注意点:android中的LinearLayout使用时,当一行填满时候,不会自动换行,
多出的将不会被显示。
代码:
<LinearLayout 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:orientation="vertical" android:paddingLeft="16dip" android:paddingRight="16dip" > <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/to" /> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/subject" /> <EditText android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="top" android:hint="@string/message" /> <Button android:layout_width="100dp" android:layout_height="wrap_content" android:layout_gravity="right" android:text="@string/send" /> </LinearLayout>截图如下:
更多相关文章
- Manifest中Activity的一些配置
- Android(安卓)解决setRequestedOrientation之后手机屏幕的旋转不
- android截图代码
- Android提高第十九篇之"多方向"抽屉[转]
- Android(安卓)中文 API (90) —— WindowManager
- android自定义视图属性(atts.xml,TypedArray)学习
- Android的用户界面
- android中文api(89)――ViewManager
- LinearLayout(线性布局)