让TextView 有滚动条的效果

网上搜了好几页都不够详细,最直接的方法就是在ScrollView 里面嵌套上TextView,关键属性设置是:
android:fadeScrollbars="true" 滚动条自动隐藏和显示,隐藏还是显示取决于内容的多少;
android:scrollbars="vertical" >  滚动条垂直方向
还有一个就是用相对布局,把TextView 定位到顶部,把菜单按钮固定在底部,如果把

TextView 替换成其他内容就是一个现在流行的界面了,比如,膜拜的地图,淘宝的列表等待




<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:fadeScrollbars="true"
        android:scrollbars="vertical" >

            <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:padding="30px"
            android:textColor="#000000"
            android:textSize="40px"/>

    </ScrollView>

             <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:radius="5dip"
            android:background="#ccc"
            android:focusable="false"
            android:text="开始" />


    </RelativeLayout>



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章