ご教授頂きたく存じます。
親LinearLayout直下にある全ての子Viewにアクセスする方法を考えておりますが、親の情報しか取れず、詰まっております。
もし、方法をご存知でしたら、ご教授頂きたく存じます。
こねくり回しているソースは下記となります。
【Javaソース】
view = inflater.inflate(R.layout.reserveheater, container, false);
ViewGroup ViewList = (ViewGroup)view.findViewById(R.id.layout);
for(int i = 0; i < ViewList.getChildCount(); i++){
View ViewChild = ViewList.getChildAt(i);
if(ViewChild instanceof EditText){
EditText mET = (EditText)ViewChild;
mET.setOnTouchListener(this);
}else if(ViewChild instanceof Spinner){
Spinner mSP = (Spinner)ViewChild;
mSP.setOnItemSelectedListener(this);
}else if(ViewChild instanceof Button){
Button mBT = (Button)ViewChild;
mBT.setOnClickListener(this);
}
}
【xml】
android:id="@+id/layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#f0ff"
android:padding="20px"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text1"
android:background="#f00f"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff00"
android:padding="20px"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text2"
android:background="#f0f0"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button"
/>
</LinearLayout>
</LinearLayout>