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);

更多相关文章

  1. Android——动态广播、静态广播
  2. Android(安卓)获取WIFI MAC地址的方法
  3. Android版本更新代码实现
  4. Android从摄像头或相册中获取照片
  5. android点击文本框之外的地方隐藏键盘
  6. android 4.1源码下载方法
  7. 获取android源代码
  8. 如何调用android内置图片,比如menu->add的加号图片,search的放大镜
  9. Android面试题集(陆续更新中)

随机推荐

  1. 【2020最新】Python爬虫工程师 - 3个月成
  2. 必知必会! MySql 高频企业面试题
  3. 如何使用Illustrator裁剪图像、调整大小?
  4. 大数据基础系列之JAVA引用详解
  5. Spark部署模式另类详解
  6. Node.js仿知乎服务端-深入理解RESTful AP
  7. hadoop系列之MR经典案例分享二
  8. Vue.js源码全方位深入解析 (含Vue3.0源码
  9. 不识别磁盘如何解决?
  10. 三分钟掌握交换机工作原理及MAC表,网工小