android 中动态添加view
来源:互联网 发布:淘宝打快递单步骤图 编辑:程序博客网 时间:2024/05/22 00:53
//动态添加view的方法
protected void addView3(LinearLayout ll_notice, ArrayList<String> list) {
LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
for(int i=0;i<list.size();i++){
LinearLayout linearLayout = (LinearLayout) LayoutInflater.
from(this).inflate(R.layout.recharge_item_content,null);
TextView tv = (TextView) linearLayout.findViewById(R.id.tv_content);
tv.setText(list.get(i));
tv.setTextSize(16);
tv.setPadding(0,10,0,0);
ll_notice.addView(linearLayout,lp2);
}
}
//布局文件
<?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:id="@+id/tv_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
- android 中动态添加view
- Android 动态添加View
- Android 动态添加View
- android动态添加view
- Android 动态添加view
- android动态添加View
- Android 动态 添加 View
- Android 动态添加View布局
- 布局中动态添加View
- Android 实现View中添加子元素的动态效果
- Android中动态添加View的两种方式
- Android 在程序中动态添加 View 布局或控件
- Android中动态添加view,删除view,获取view的内容
- (转)Android中动态添加view,删除view,获取view的内容
- android 动态添加View 两种方法
- Android 动态添加View并设置padding
- 向Linearlaout中动态添加view
- 在ScrollView中动态添加View
- Git查看并修改name和email
- 中国有句古话,叫做日后好相见
- android服务- Notification创建通知 - startForeground 使用前台服务
- 收藏一些官方文档
- JS的简单交互(web代理)
- android 中动态添加view
- android之adapter用法总结
- 【算法】N后问题
- 关于oracle 解锁(行级锁、表级索)
- LeetCode:Maximum Product Subarray
- iOS 一些常用的手机号、密码、数字等判断
- 设计模式笔记--原型模式
- 胡适:非个人主义的新生活
- java数据库连接池技术