动态添加多个相同布局、获取内容

本文介绍了如何在Android应用中实现动态添加多个相同布局的功能,并记录了添加布局的步骤,包括初始化布局、动态添加以及获取每个布局内输入的内容。参考了一位大神的博客实现这一功能。
摘要由CSDN通过智能技术生成

最近要做个动态添加N个重复布局的功能、这种做法也是看了别的大神的博客、做下记录

 

 

外层布局文件

<LinearLayout
    android:id="@+id/layout_implement"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <TextView
        style="@style/text_sp15"
        android:layout_gravity="center_vertical"
        android:paddingBottom="@dimen/qb_px_8"
        android:paddingLeft="@dimen/qb_px_15"
        android:paddingRight="@dimen/qb_px_15"
        android:paddingTop="@dimen/qb_px_8"
        android:text="PTR实施过程" />
    <View style="@style/line" />
    <LinearLayout
        android:id="@+id/layout_add"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
    </LinearLayout>
    <TextView
        android:id="@+id/tv_again"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:layout_marginRight="@dimen/qb_px_15"
        android:layout_marginTop="@dimen/qb_px_10"
        android:background="@drawable/btn_shape"
        android:paddingBottom="@dimen/qb_px_5&#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值