我需要 XML 样式来显示选项卡的开启或关闭状态,当我点击按钮时,在按钮上显示圆角矩形。我如何为给定的图片创建新样式,请给我一些提示如何创建类似于此图像的圆角矩形样式。
为此,在选项卡背景中添加圆角图像:
tab = tabs.newTabSpec("tab_Busquedas");
tab.setContent(new Intent().setClassName("com.grapp", "com.grapp.homes").putExtras(bundle));
tab.setIndicator(null,null);
tabs.addTab(tab);
//here you set the image with rounded corners over the tab.
tabs.getTabWidget().getChildAt(0).setBackgroundResource(R.drawable.mytab_roundedcorners);
这个解决方案发布在:如何在Android 2.1+中实现圆形标签页。
http://developer.android.com/guide/topics/ui/themes.html
如果您使用此功能,维护也将变得容易。