2010-07-17 3 views
1

아무도 날 안드로이드 2.1 +와 TabWidget에 대한 둥근 모서리를 얻을 수 있습니다. 기본적으로 TabWidget에 XML 구성을 통해 사용자 지정 테마를 제공하려고합니다. 다음을 시도했지만 텍스트 색상 만 변경됩니다.안드로이드 2.1 +에서 반올림 탭을 달성하는 방법

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <color name="Tab_ForeColor">#6095C1</color> 
    <color name="Tab_BackgroundColor">#411485</color> 

    <style name="TestTheme" parent="android:Theme.Black"> 
     <item name="android:tabWidgetStyle">@style/TestTab</item> 
    </style> 

    <style name="TestTab" parent="@android:style/Widget.TabWidget"> 
     <item name="android:textAppearance">@style/TestTextApperance</item> 
     <item name="android:drawable"> 
      <drawable name="rounded_tab"> 
       <shape xmlns:android="http://schemas.android.com/apk/res/android" 
        android:shape="rectangle"> 
        <stroke android:width="3dip" android:color="@android:color/white" /> 
        <solid android:color="@android:color/white" /> 
        <corners android:bottomRightRadius="0.1dip" 
         android:bottomLeftRadius="0.1dip" android:topLeftRadius="15dip" 
         android:topRightRadius="15dip" /> 
       </shape> 
      </drawable> 
     </item> 
    </style> 

    <style name="TestTextApperance"> 
     <item name="android:textSize">14dp</item> 
     <item name="android:textStyle">normal</item> 
     <item name="android:textColor">@color/Tab_ForeColor</item> 
    </style> 
</resources> 

은 TIA

앤드류 솔루션이 탭을 통해 둥근 모서리 이미지를 설정하는 것입니다

답변

4

, 나는 치즈 맛이 나는 해결책을 알고 있지만 작동합니다.

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); 

R.drawable.mytab_roundedcorners가 선택기입니다.

+0

답변 해 주셔서 감사합니다. 가능한 경우 xml에서이 작업을 수행 할 수있는 방법을 찾기 위해 계속 노력할 것입니다.하지만 내가 필요한 것을 수행 할 때 응답을 받아 들일 것입니다. :-) 감사. –

관련 문제