android 中ScrollView的使用
16lz
2021-01-24
android中布局一般都有两种方式,一种xml声明,另外一种则是程序声明:
xml:
<?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>
手动代码声明:
TextView txt=new TextView(this); txt.setText(str); ScrollView scrollView = new ScrollView(this); scrollView.addView(txt); setContentView(scrollView);
更多相关文章
- Android——动态广播、静态广播
- Android(安卓)获取WIFI MAC地址的方法
- Android版本更新代码实现
- Android从摄像头或相册中获取照片
- android点击文本框之外的地方隐藏键盘
- android 4.1源码下载方法
- 获取android源代码
- 如何调用android内置图片,比如menu->add的加号图片,search的放大镜
- Android面试题集(陆续更新中)