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

     

  • 相关阅读:
    FaceBook API
    CAP – Consistency, Availability, Partition Tolerance
    Hypothesis Testing
    MOSS 2007中如何添加VariationsLabelMenu来在不同语言的variation间切换?
    用Windows 2008 R2做工作机遇到的IE的安全问题
    如何使用Notepad++快速整理挤在一起的CallStack信息(将换行符作为被替换的内容)
    Managed Metadata Service介绍系列 之四
    MOSS 2007捞取ConfigDB中的数据, 得到内部名所对应的timer job的title及运行状况
    Log Parser分析IIS log的举例
    EventCache表太大, 怎么办?
  • 原文地址:https://www.cnblogs.com/chenyg32/p/3233396.html
Copyright © 2011-2022 走看看