码迷,mamicode.com
首页 > 移动开发 > 详细

Android 开发笔记___滚动视图__scroll view

时间:2017-07-01 12:45:01      阅读:212      评论:0      收藏:0      [点我收藏+]

标签: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     <LinearLayout
15         android:layout_width="match_parent"
16         android:layout_height="200dp">
17 
18         <HorizontalScrollView
19             android:layout_width="wrap_content"
20             android:layout_height="match_parent">
21 
22             <LinearLayout
23                 android:layout_width="wrap_content"
24                 android:layout_height="match_parent">
25 
26                 <View
27                     android:layout_width="400dp"
28                     android:background="#aaffff"
29                     android:layout_height="match_parent"/>
30 
31                 <View
32                     android:layout_width="400dp"
33                     android:layout_height="match_parent"
34                     android:background="#ffff00"/>
35 
36             </LinearLayout>
37         </HorizontalScrollView>
38 
39     </LinearLayout>
40 
41     <ScrollView
42         android:fillViewport="true"
43         android:layout_width="match_parent"
44         android:layout_height="wrap_content">
45 
46         <LinearLayout
47             android:layout_width="match_parent"
48             android:orientation="vertical"
49             android:layout_height="wrap_content">
50 
51             <View
52                 android:layout_width="match_parent"
53                 android:background="#aa5511"
54                 android:layout_height="400dp"/>
55 
56             <View
57                 android:layout_width="match_parent"
58                 android:layout_height="400dp"
59                 android:background="#ffff00"/>
60 
61             <TextView
62                 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     @Override
15     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

标签:vertica   log   效果   intent   滚动   fill   垂直   super   stat   

原文地址:http://www.cnblogs.com/alimjan/p/7101794.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!