LayoutInflater
来源:互联网 发布:mac 10.7.5 dmg 编辑:程序博客网 时间:2024/06/08 08:12
include.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="输入内容"/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="请输入内容"/>
</LinearLayout>
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);
LinearLayout linearLayout = new LinearLayout(this);//动态创建LinearLayout
linearLayout.setOrientation(LinearLayout.VERTICAL);//设置布局为vertical
LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
linearLayout.setLayoutParams(params);
//布局片段
LayoutInflater inflater = getLayoutInflater();
View view1 = inflater.inflate(R.layout.include, null);
View view2 = inflater.inflate(R.layout.include, null);
linearLayout.addView(view1);
linearLayout.addView(view2);
setContentView(linearLayout);
}
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- SpringMvc 拦截器 Interceptor的基础知识
- 【有感】《菊与刀》——换个角度看日本
- CSS中关于定位的问题, 相对,绝对定位
- 电子海图7Csahara.000解析结果
- 软考之路(三)——数据结构之查找表与哈希表
- LayoutInflater
- spark countByKey用法详解
- Promise
- 第十二周项目一-实现复数类中的运算符重载(3)
- HTML中的<head/>不能省略
- centos7的一些改变
- 自定义View遇到的小坑
- 【github】github 使用教程初级版【wins】
- MySQL函数-- FIND_IN_SET的使用