2012-05-21 2 views
1

의도 한대로 작동하는 한 쌍의 스피너가 있지만, 그 위에 drawable을 놓으면 텍스트가 사라집니다. 다음은 Layout과 Drawable의 XML입니다. 여기서 유일한 문제는 드로어 블이 텍스트를 보이게하지 않는다는 것입니다.텍스트를 표시하지 않는 사용자 정의 배경을 가진 회 전자

ttd_list.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical" > 

<include 
    android:id="@+id/include1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    layout="@layout/action_bar" /> 

<LinearLayout 
    android:id="@+id/ll1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" android:background="@color/gray"> 

    <RelativeLayout 
     android:id="@+id/relativeLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:descendantFocusability="beforeDescendants" 
     android:focusableInTouchMode="true" 
     android:paddingBottom="8dip" > 

     <AutoCompleteTextView 
      android:id="@+id/autoCompleteThingsToDo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_marginTop="8dip" 
      android:layout_toLeftOf="@+id/buttonSearchThingsToDo" 
      android:textColor="#000000" > 
     </AutoCompleteTextView> 

     <Button 
      android:id="@+id/buttonSearchThingsToDo" 
      style="@style/StandardButton" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_alignTop="@+id/autoCompleteThingsToDo" 
      android:text="@string/search" /> 
    </RelativeLayout> 

    <TableRow 
     android:id="@+id/tableRow1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingBottom="8dip" > 

     <Spinner 
      android:id="@+id/spinnerCategories" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@drawable/spinner_filters" /> 

     <View 
      android:layout_width="10dip" 
      android:layout_height="match_parent" /> 

     <Spinner 
      android:id="@+id/spinnerSortOrder" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@drawable/spinner_filters" /> 
    </TableRow> 
</LinearLayout> 

<ListView 
    android:id="@+id/listViewThingsToDo" 
    android:layout_width="match_parent" 
    android:layout_height="0dip" 
    android:layout_weight="1" > 
</ListView> 

spinner_filters.xml

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

<item android:drawable="@drawable/spinnerbg" android:state_pressed="true"><shape> 
     <solid android:color="@color/blue" /> 

     <stroke android:color="@color/blue" /> 

     <corners android:radius="3dp" /> 
    </shape></item> 
<item android:drawable="@drawable/spinnerbg" ><shape> 
     <solid android:color="#00000000" /> 

     <corners android:radius="3dp" /> 
    </shape></item> 

</selector> 

spinnerbg.9.png :

enter image description here

텍스트가 보이지 않는 이유는 무엇입니까?

편집 : 확인, 이미 해결했습니다. 문제는 9.png 파일에 거짓말을했는데 제대로 설계되지 않았습니다.

+0

문제가 무엇인지 자세히 설명해 주시겠습니까? 나는 똑같은 문제에 직면 해있다. – Niels

+1

@Niels 그것은 쉬운 문제입니다 : 당신은 sdk 도구로 9.png을 편집해야합니다. 텍스트를 포함 할 픽셀을 오른쪽 아래에 놓아야합니다. – razielsarafan

답변

0

내부 텍스트가 흰색 일 수 있습니다. 배경색을 변경하여 확실하게 ...

+0

이미 색상을 변경해 보았습니다. 사실, 파란색 삼각형과 밑줄의 바깥 쪽 배경은 투명합니다. 스피너가 포함 된 레이아웃의 색상을 검정색과 흰색으로 변경했으며 텍스트를 볼 수 없었습니다. – razielsarafan

+0

어댑터의 코드를 붙여 넣을 수 있습니까? –

+0

나는 이미 그것을 해결했다, 그것은 내 9.png 파일 내에서 문제가되었다. – razielsarafan

관련 문제