Here is my layout.
<LinearLayout
android:id="@+id/lyt_linearNative"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone" >
<LinearLayout
android:id="@+id/lyt_tp1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/vmax_iv_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bee7_btn_close" />
<LinearLayout
android:id="@+id/lyt_tp2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/vmax_tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="title" />
<TextView
android:id="@+id/vmax_tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="2"
android:text="Description" />
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/black" />
<LinearLayout
android:id="@+id/lyt_tp3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/vamx_tv_totalInstall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="total install" />
<TextView
android:id="@+id/vamx_tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginLeft="50dp"
android:text="Price" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Please consider the above layout as template only. There can be any number of children.
I want to check vmax_tv_desc is exists in lyt_linearNative or not. I know we can get the direct child by using
View nextChild = ((ViewGroup)parentView).getChildAt(i);
But I want to check for the indirect child. Any help will appreciated.
Thanks,
As answer as requested in comment-section:
I would not use by index because it couples code<>layout to tight - you just can findViewById on your parent:
parentView.findViewById(vmax_tv_desc)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With