의도 한대로 작동하는 한 쌍의 스피너가 있지만, 그 위에 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 :
텍스트가 보이지 않는 이유는 무엇입니까?
편집 : 확인, 이미 해결했습니다. 문제는 9.png 파일에 거짓말을했는데 제대로 설계되지 않았습니다.
문제가 무엇인지 자세히 설명해 주시겠습니까? 나는 똑같은 문제에 직면 해있다. – Niels
@Niels 그것은 쉬운 문제입니다 : 당신은 sdk 도구로 9.png을 편집해야합니다. 텍스트를 포함 할 픽셀을 오른쪽 아래에 놓아야합니다. – razielsarafan