android java写布局LinearLayou.LayoutParams参数
2015-11-27 11:00
399 查看
private LinearLayout layout;//创建一个布局
layout = mLayout = (LinearLayout) findViewById(R.id.layout);
TextView text = new TextView(MainActivity.this);
text.setText("往layout中添加TextView");
//设置LinearLayout的参数,(宽,高)
LinearLayout.LayoutParams p =
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
layout.addView(text,p);//往layout中添加TextView
layout = mLayout = (LinearLayout) findViewById(R.id.layout);
TextView text = new TextView(MainActivity.this);
text.setText("往layout中添加TextView");
//设置LinearLayout的参数,(宽,高)
LinearLayout.LayoutParams p =
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
layout.addView(text,p);//往layout中添加TextView
相关文章推荐
- Android分享功能源码解读
- Android创建桌面快捷方式几种方法
- android客户端与服务器端交互 如何保持session
- android数据库中读写cookie
- Android持久化保存cookie
- android 休眠唤醒机制分析(三)
- android 休眠唤醒机制分析(二)
- JS调用android
- android 5.0及以上,seekbar thumb 透明效果出现父布局背景颜色的解决方法
- android 休眠唤醒机制分析(一)
- Android学习笔记(四):Volley的使用
- android studio里面的svn基本使用
- android中shape、selector、color
- Android防止重复点击深入
- Jenkins+ Gradle +Lint对Android工程源码进行静态代码分析
- Android 控件布局常用属性
- Android入门:增删改查通讯录
- Android Studio 配置Android Annotation
- Android imageview帧动画 监听结束
- Android布局属性说明