zoukankan      html  css  js  c++  java
  • ScrollView

    理论部分

    1ScrollViewHorizontalScrollView是为控件或者布局添加滚动条

    2、上述两个控件只能有一个孩子

    3、上述两个控件可以互相嵌套

    4ScrollView实现垂直滚动条,HorizontalScrollView实现水平滚动条

    5、滚动条的位置由layout_widthlayout_height决定(滚动条的位置都在边缘处)

    疑问是:

    下面这个例子的ScrollView layout_widthfill_parent,但是却是wrap_conttent的效果。所以滚动条在屏幕外。

     

    <?xml version="1.0" encoding="utf-8"?>
    <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
                          android:layout_width="fill_parent"
                          android:layout_height="fill_parent">
    
        <ScrollView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
    
            <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
    
                <TextView
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/hello"
                        android:textSize="90sp"/>
            </LinearLayout>
        </ScrollView>
    </HorizontalScrollView>

     

    package com.example.ScrollView;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    public class ScrollView extends Activity
    {
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
        }
    }
    View Code

    转:http://blog.csdn.net/scyatcs/article/details/7942585

     

  • 相关阅读:
    Groovy 闭包_胖子的家_百度空间
    活动 | Think+大声思考
    微软对联背后的故事
    核心技术研发工程师 百度在线网络技术(北京)有限公司 庞果网Pongo.cn
    Groovy 闭包深入浅出 终点就是起点 ITeye技术网站
    Groovy闭包深入学习 [203] 一直都有新高度 ITeye技术网站
    用groovy写抓票程序
    eating machine=chi huo
    sql case when学习
    韦式词典发音
  • 原文地址:https://www.cnblogs.com/chenyg32/p/3233396.html
Copyright © 2011-2022 走看看