I have Tab Layout that contains a TextView. I’d like to assign some text at runtime to the TextView. I thought this would work:
((TextView)getParent().findViewById(R.id.status)).setText("Some Text");
but the text is never set.
This is my layout:
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="0dp" <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="0dp" android:background="@drawable/tab_bg_selector" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="0dp" /> <TextView android:id="@+id/status" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="Last Updated" android:layout_alignParentBottom="true" android:background="#cccccc" /> </LinearLayout> <RelativeLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="10dp" android:layout_alignParentBottom="true"> <TextView android:id="@+id/status" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#cccccc" /> </RelativeLayout> </TabHost>
try this: