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


     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 的使用,有两种。
    垂直方向、水平方向。
    视图里面只能放一个布局"/>
    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 }
  • 相关阅读:
    在DNN模块开发中使用jQuery
    在MSBuild.exe中使用条件编译(Conditional Compile)
    ASP.NET SQL 注入免费解决方案
    html+css做圆角表格
    [ASP]sitemap地图生成代码
    刺穿MYIE|24小时同一ip弹一次|无须body加载|精简代码
    用ASPJPEG组件制作图片的缩略图和加水印
    16个经典面试问题回答思路[求职者必看]
    一个26岁IT男人写在辞职后
    搜弧IT频道的幻灯片切换的特效源代码
  • 原文地址:https://www.cnblogs.com/alimjan/p/7101794.html
Copyright © 2020-2023  润新知