Android 如何获取动态创建的线性布局及其子ImageView的标记

Android 如何获取动态创建的线性布局及其子ImageView的标记,android,android-layout,layout,dynamic,Android,Android Layout,Layout,Dynamic,母线布局 LinearLayout TextView LinearLayout 我在XML中有一个父线性布局。 我动态创建了一个线性布局,其子级是TextView和线性布局。 我将此布局添加到父线性布局中 现在我的问题是如何获得Linear Layout4th的标记及其子级的标记,稍后我将动态添加这些标记 for(int i=0;i<parent_Layout.getChildCount();i++){

母线布局

        LinearLayout
             TextView
             LinearLayout
我在XML中有一个父线性布局。 我动态创建了一个线性布局,其子级是TextView和线性布局。 我将此布局添加到父线性布局中

现在我的问题是如何获得Linear Layout4th的标记及其子级的标记,稍后我将动态添加这些标记

for(int i=0;i<parent_Layout.getChildCount();i++){
                    View v=parent_Layout.getChildAt(i);
                    Toast.makeText(getApplicationContext(),""+parent_Layout.getChildCount() , Toast.LENGTH_LONG).show();

                }

我正在尝试这样做,但我不知道如何实现这一点

您可以在布局上使用setTag之类的东西…然后使用getTag检索布局。希望这对您有所帮助