Итак, у меня есть макет xml, похожий на следующий пример:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/tile_bg" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="10dp" >
<LinearLayout
android:id="@+id/layout_0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<!-- view stuff here -->
</LinearLayout>
<!-- more linear layouts as siblings to this one -->
</LinearLayout>
На самом деле у меня около 7 элементов LinearLayout, каждый из которых увеличивает id от layout_0 и т.д. Я хочу иметь возможность захватить все элементы LinearLayout под корневым LinearLayout. Нужно ли вводить идентификатор в корневой папке и находить все остальные по id или я могу получить их по типу.
Код, который я использую для раздувания макета:
View view = (View) inflater.inflate(R.layout.flight_details, container, false);
Я где-то читал, что вы можете перебирать детей из ViewGroup, но это только вид.
Каков наилучший способ получить кучу детей по типу?