The reason for my question, I still don't really know which other properties or children are available, and this will sure be the case for other controls.
So which is the best way to find out that e.g. the TabWidget has a child at position 0, which has layout params, where i can set the height (just an example). Besides http://developer.android.com/reference/android/widget/TabHost.html
tabHost.setCurrentTab(2);
tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 60;
tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 60;
tabHost.getTabWidget().getChildAt(2).getLayoutParams().height = 60;
// Bump the text size up
LinearLayout ll = (LinearLayout) tabHost.getChildAt(0);
android.widget.TabWidget tw = (android.widget.TabWidget) ll.getChildAt(0);
{
RelativeLayout rllf = (RelativeLayout) tw.getChildAt(0);
TextView lf = (TextView) rllf.getChildAt(1);
lf.setTextSize(20);
}
{
RelativeLayout rllf = (RelativeLayout) tw.getChildAt(1);
TextView lf = (TextView) rllf.getChildAt(1);
lf.setTextSize(20);
}
{
RelativeLayout rllf = (RelativeLayout) tw.getChildAt(2);
TextView lf = (TextView) rllf.getChildAt(1);
lf.setTextSize(20);
}
Besides the online documentation on View and its subclasses, which include the all properties on a view available to modify in XML/code, you can use Hierarchyviewer to inspect layouts on the fly.
Also, as far as your code goes, instead of creating tabs and then modifying them in code, you could have also used TabSpec.setIndicator
to just set a custom layout for the tab.
You might like to try running the hierarchyviewer.bat in the tools folder. This gives you a visual tree/hierarchy view and shows you the properties of each element.
精彩评论