LayoutInflater
来源:互联网 发布:linux怎么改变用户目录 编辑:程序博客网 时间:2024/05/01 17:36
package com.example.android_test_1206;import android.annotation.SuppressLint;import android.app.Activity;import android.app.AlertDialog;import android.content.Context;import android.os.Bundle;import android.view.LayoutInflater;import android.view.View;import android.widget.RelativeLayout;public class MainActivity extends Activity {public MainActivity(){super();}@SuppressLint("NewApi")@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);// 当这样的话,// 默认调用inflate(R.layout.fragment_main,null,false);// 为false,则null仅被用来创建在xml文件中的root viewgroup的layoutparams。// 即为:layout_height和layout_width均为wrap_content.// 参数root不作为 xml文件的root// 此时,root为null,则创建的layoutparams则为默认情况。RelativeLayout relativeLayout1 = (RelativeLayout) LayoutInflater.from(getBaseContext()).inflate(R.layout.fragment_main, null);Context context=getBaseContext();RelativeLayout relativeLayout2 = (RelativeLayout) LayoutInflater.from(getBaseContext()).inflate(R.layout.fragment_main, null, false);AlertDialog.Builder builder=new AlertDialog.Builder(MainActivity.this);AlertDialog.Builder builder2=new AlertDialog.Builder(getBaseContext());//.inflate(R.layout.item_row,null,false)View content = LayoutInflater.from(getBaseContext()).inflate(R.layout.item_row, null); builder.setTitle("My Dialog");builder.setView(content);builder.setPositiveButton("OK", null);builder.show();}}
0 0
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- LayoutInflater
- ABAP中的转义符 #
- android自定义相机
- SVN 各种标志的意义
- 内存管理单元(MMU)介绍
- 深入学习J2EE的好例子,集成spring,datajpa,springmvc,shiro,freemarker,quartz(需要一定J2EE基础)
- LayoutInflater
- 关于孝敬老人的名言
- ABAP程序执行效率优化
- 【LeetCode】Unique Paths 解题报告
- C/C++操作符号的优先级
- 使用isolinux制作Linux启动光盘
- uva846简单数学题
- win8安装msi
- UVa做题阶段性总结(2014-12-08)——百题完结