سؤال

I have created four tabs but want each tab to be a different block color - should this be done in the xml or java file? I'm assuming java because I only have one xml file for the whole tab widget.

هل كانت مفيدة؟

المحلول

try to customise the individual tabs try using something like

TabWidget tabWidget = getTabWidget();
for(int i = 0; i < tabWidget.getChildCount(); i++) {
RelativeLayout tabLayout = (RelativeLayout) tabWidget.getChildAt(i);
tabLayout.setBackgroundDrawable(someimage);
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top