Android - User Interface
2015-12-06 17:45
381 查看
> You can declare a layout in two ways:
Declare UI elements in XML. Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses, such as those for widgets and layouts.
Instantiate layout elements at runtime. Your application can create View and ViewGroup objects (and manipulate their properties) programmatically.
》RelativeLayout
By default, all child views are drawn at the top-left of the layout, so you
must define the position of each view using the various layout properties available from
Declare UI elements in XML. Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses, such as those for widgets and layouts.
Instantiate layout elements at runtime. Your application can create View and ViewGroup objects (and manipulate their properties) programmatically.
》RelativeLayout
By default, all child views are drawn at the top-left of the layout, so you
must define the position of each view using the various layout properties available from
RelativeLayout.LayoutParams.
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="16dp" android:paddingRight="16dp" > <EditText android:id="@+id/name" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/reminder" /> <Spinner android:id="@+id/dates" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_below="@id/name" android:layout_alignParentLeft="true" android:layout_toLeftOf="@+id/times" /> <Spinner android:id="@id/times" android:layout_width="96dp" android:layout_height="wrap_content" android:layout_below="@id/name" android:layout_alignParentRight="true" /> <Button android:layout_width="96dp" android:layout_height="wrap_content" android:layout_below="@id/times" android:layout_alignParentRight="true" android:text="@string/done" /> </RelativeLayout>
相关文章推荐
- android错误详解教程一
- 如何配置Android应用程序的操作权限
- Android 动态测量list view item的高度
- Android SQlite
- Android学习问题
- Android批量打包提速 - 1分钟900个市场不是梦
- Gradle多渠道打包 (1)
- 判断是不是Android 5.0 Lollipop
- Android dip转px
- android studio使用异常解决记录
- 【android】seekbar 样式自定义
- 解决android开发中无法trycatch到由唯一性约束导致的数据库insert不进数据erro的问题
- Android获取状态栏、标题栏、ActionBar以及屏幕的高度
- Android中使用Dialog风格弹出框的Activity
- Android中在Button控件上显示倒计时
- Android自定义GifView显示gif动画
- Android间进程通信
- Android最新动画框架完全解析(二)——Transitions Framework(Transitions 框架)
- 怎样在Android Studio中调试
- Android控件之ProgressDialog