当前位置:操作系统 > 安卓/Android >>

Android学习笔记技巧之垂直和水平滚动视图

 

 \ \

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 
 
    <HorizontalScrollView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" > 
 
        <RelativeLayout 
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent" 
            android:orientation="horizontal" > 
 
            <TextView 
                android:id="@+id/textview1" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:gravity="center_vertical" 
                android:text="垂直和水平滚动" 
                android:textSize="30dp" /> 
             
            <ImageView 
                android:id="@+id/imageview1" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_below="@id/textview1" 
                android:src="@drawable/item1" /> 
 
            <ImageView 
                android:id="@+id/imageview2" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_toRightOf="@id/imageview1" 
                android:layout_below="@id/textview1" 
                android:src="@drawable/item2" /> 
 
            <TextView 
                android:id="@+id/textview2" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_below="@id/imageview1" 
                android:text="垂直和水平滚动" 
                android:textSize="30dp" /> 
 
            <ImageView 
                android:id="@+id/imageview2" 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:layout_below="@id/textview2" 
                android:src="@drawable/item3" /> 
        </RelativeLayout> 
    </HorizontalScrollView> 
  

 </ScrollView>
 <?xml version="1.0" encoding="utf-8"?>
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content" >
 
    <HorizontalScrollView
         android:layout_width="fill_parent"
         android:layout_height="wrap_content" >
 
        <RelativeLayout
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
             android:orientation="horizontal" >
 
            <TextView
                 android:id="@+id/textview1"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:gravity="center_vertical"
              &
补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,