RelativeLayout 让子元素指定它们相对于其他元素的位置(通过ID 来指定)或相对于父布局对象。
本例使用RelativeLayout 显示三个TextView ,其中第二个TextView(id/view3)占据整个屏幕中间部分,前面我们已经介绍了如何使用LinearLayout,通过指定View的权重实现同样的效果Android ApiDemos示例解析(143):Views->Layouts->LinearLayout->3. Vertical (Padded)
本例使用RelativeLayout ,因为需要通过制定其它View作为参照物,所有子View必须定义id,其它子View通过指定参照物的id来确定其相对位置。
<RelativeLayoutxmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”match_parent”
android:layout_height=”match_parent”>
<!– view1 goes on top –>
<TextView
android:id=”@+id/view1″
android:background=”@drawable/red”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:layout_alignParentTop=”true”
android:text=”@string/relative_layout_1_top”/>
<!– view2 goes on the bottom –>
<TextView
android:id=”@+id/view2″
android:background=”@drawable/green”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:layout_alignParentBottom=”true”
android:text=”@string/relative_layout_1_bottom”/>
<!– view3 stretches betweeen view1 and view2 –>
<TextView
android:id=”@+id/view3″
android:background=”@drawable/yellow”
android:layout_width=”match_parent”
android:layout_height=”0dip”
android:layout_above=”@id/view2″
android:layout_below=”@id/view1″
android:text=”@string/relative_layout_1_center”/>
</RelativeLayout>
TextView1 (id/view1) 指出其相对于父容器RelativeLayout的layout_alignParentTop为True,因此其显示在屏幕顶部。
TextView2 (id/view2) 指出其相对于父容器RelativeLayout的android:layout_alignParentBottom为True,因此其显示在屏幕底部。
TextView3(id/view3) 高度设为0,但通过android:layout_above和android:layout_below指出它和TextView1于TextView2之间的相对位置(和两个TextView上下相邻),因此TextView3占据所有剩余的中间部分。
相关推荐
NULL 博文链接:https://kakukemeit.iteye.com/blog/1806388
android apidemos代码的示例解析,讲的挺全的
Android ApiDemos apk, 包括Android presentation双屏异显 demon, App>Activity>Presentation
最新版ApiDemos Android SDK 中带有很多例子,其中ApiDemo 详细介绍了Android 平台主要API,分成了 · App · Content · Graphics · Media · OS · Text · Views 几个大类,每个大类又分为几个小类,...
demos :jdk-8u202-linux-x64-demos.tar.gz
jdk-8u151-linux-i586-demos.gz
demos :jdk-8u202-linux-arm64-vfp-hflt-demos.tar.gz
最新Android apidemos
Run demos in Assets/FairyGUI/Examples/Scenes. The UI project is in Examples-UIProject.zip, unzip it anywhere. Use FairyGUI Editor to open it. Using FairyGUI in Unity: * Place a UIPanel in scene by ...
从官方预览包里提取的Android6.0 ApiDemos.apk,方便安装在真机上查看实例的实际效果。
文件名称: jdk-8u231-solaris-x64-demos.tar.gz 文件大小: 8.43 MB (8,846,115 字节) MD5: 3b62803c4e86b40f1a83b68be7bce224 SHA1: 3aba5de2157163b949179a5b654494da05b4da9c SHA256: 774c5d41a1422d22d026eaaa39...
Microsoft.Premium.DP-300.by_.VCEup_.82q-DEMOS.pdf
<EhLib Archive> \ Demos \ DBVertGridEh.SimpleDemo \ Project1.dpr compiled project: <EhLib Archive> \ Demos \ Bin \ DBVertGridEh.SimpleDemo.Exe * There are changes in the grids inheritance tree: ...
api ------------- API目录 demos ------------- 本地demos目录 lib ------------- 框架源代码目录 index.htm ------------- 主页面 loading.gif ------------- loading图标 welcome.htm ------------- 欢迎页面 ...
<EhLib Archive> \ Demos \ DBVertGridEh.SimpleDemo \ Project1.dpr compiled project: <EhLib Archive> \ Demos \ Bin \ DBVertGridEh.SimpleDemo.Exe * There are changes in the grids inheritance tree: ...
API Demos 是 Google 为了 Android 开发者所提供的一个 Android API 合集,其中包含了很多的 API 范例,同时遵循了良好的代码规范,是一个值得开发者研究和学习的典型。android的ApiDemos,需要解压缩后使用。
r下载后,解压,把解压后的文件直接放入到red5webaaps下
vertical-align fix. [win] fix of WM_SETTINGCHANGE handling for some types of windows. [css] Fix of hsl/hsv() color transforms: samples/css++/hsl-colors.htm r5010 regression (forcing padding, margin ...
android APIdemos,android 源码简单使用demos
WAR File: dwr.war (4.62Mb) Demos/Examples of what DWR can do Sources: dwr-3.0.0.116.rc1-src.zip (71Mb) See also the sources from SVN Non-CLA JAR: dwr-noncla.jar (15.8kb) Code that we don't ...