android 中ScrollView的使用

时间:2014-09-08 02:11:56   收藏:0   阅读:296

android中布局一般都有两种方式,一种xml声明,另外一种则是程序声明:

xml:

bubuko.com,布布扣
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
  
    <ScrollView 
        android:id="@+id/Scroll"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
        <TextView 
            android:id="@+id/txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
    </ScrollView>
     


</LinearLayout>
bubuko.com,布布扣


手动代码声明:

TextView txt=new TextView(this);
        txt.setText(str);
        ScrollView scrollView = new ScrollView(this);
        scrollView.addView(txt);
        setContentView(scrollView);

原文:http://blog.csdn.net/tw19811220/article/details/39127433

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!