Android 開發筆記___滾動視圖__scroll view

來源:互聯網
上載者:User

標籤:vertica   log   效果   intent   滾動   fill   垂直   super   stat   

 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3     android:orientation="vertical" android:layout_width="match_parent" 4     android:layout_height="match_parent"> 5  6     <TextView 7         android:layout_width="wrap_content" 8         android:layout_height="wrap_content" 9         android:text="示範效果"10         android:textColor="@color/text_color"11         android:textSize="25sp"12         android:layout_gravity="center"/>13 14     <LinearLayout15         android:layout_width="match_parent"16         android:layout_height="200dp">17 18         <HorizontalScrollView19             android:layout_width="wrap_content"20             android:layout_height="match_parent">21 22             <LinearLayout23                 android:layout_width="wrap_content"24                 android:layout_height="match_parent">25 26                 <View27                     android:layout_width="400dp"28                     android:background="#aaffff"29                     android:layout_height="match_parent"/>30 31                 <View32                     android:layout_width="400dp"33                     android:layout_height="match_parent"34                     android:background="#ffff00"/>35 36             </LinearLayout>37         </HorizontalScrollView>38 39     </LinearLayout>40 41     <ScrollView42         android:fillViewport="true"43         android:layout_width="match_parent"44         android:layout_height="wrap_content">45 46         <LinearLayout47             android:layout_width="match_parent"48             android:orientation="vertical"49             android:layout_height="wrap_content">50 51             <View52                 android:layout_width="match_parent"53                 android:background="#aa5511"54                 android:layout_height="400dp"/>55 56             <View57                 android:layout_width="match_parent"58                 android:layout_height="400dp"59                 android:background="#ffff00"/>60 61             <TextView62                 android:layout_width="match_parent"63                 android:layout_height="wrap_content"64                 android:text="scrollview 的使用,有兩種。\n垂直方向、水平方向。\n視圖裡面只能放一個布局"/>65 66         </LinearLayout>67 68     </ScrollView>69 70 </LinearLayout>

java

 1 package com.example.alimjan.hello_world; 2  3 import android.app.Activity; 4 import android.content.Context; 5 import android.content.Intent; 6 import android.os.Bundle; 7 import android.support.annotation.Nullable; 8  9 /**10  * Created by alimjan on 6/30/2017.11  */12 13 public class class__2_2_3 extends Activity {14     @Override15     protected void onCreate(@Nullable Bundle savedInstanceState) {16         super.onCreate(savedInstanceState);17         setContentView(R.layout.code_2_2_3);18     }19 20     public static void startHome(Context mContext) {21         Intent intent = new Intent(mContext, class__2_2_3.class);22         mContext.startActivity(intent);23     }24 }

 

Android 開發筆記___滾動視圖__scroll view

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.