-
<?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" >
-
-
<ScrollView
-
android:id="@+id/scrollView1"
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:layout_alignParentLeft="true"
-
android:layout_alignParentTop="true" >
-
-
<TextView
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:text="作者-敬水仙:新华社记者在叙空军情报局分局看到~~~" />
-
</ScrollView>
-
-
<Button
-
android:id="@+id/button1"
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:layout_alignParentBottom="true"
-
android:layout_alignParentLeft="true"
-
android:text="Button" />
-
- </RelativeLayout>
效果二
-
<?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" >
-
-
<Button
-
android:id="@+id/button1"
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:layout_alignParentBottom="true"
-
android:layout_alignParentLeft="true"
-
android:text="Button" />
-
-
<ScrollView
-
android:id="@+id/scrollView1"
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:layout_alignParentLeft="true"
-
android:layout_alignParentTop="true"
-
android:layout_above="@id/button1" >
-
-
<TextView
-
android:layout_width="wrap_content"
-
android:layout_height="wrap_content"
-
android:text="作者-敬水仙:新华社记者在叙空军情报局分局看到~~~~~~~" />
-
</ScrollView>
-
-
-
- </RelativeLayout>
本文通过两个实例对比展示了在Android应用开发中,如何合理使用ScrollView与Button的布局方式来达到不同的视觉效果。重点在于调整ScrollView和Button的位置关系及层级顺序。
1万+

被折叠的 条评论
为什么被折叠?



