Spinner с пользовательским фоном не показывает текст

1

У меня есть пара спиннеров, которые работают точно так, как предполагалось, но когда я накладываю на них наброски, текст просто исчезает. Вот XML как Layout, так и Drawable. Единственная проблема здесь в том, что drawable не позволяет тексту появляться.

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:

Изображение 174551

Любая идея о том, почему текст не появляется?

EDIT: Хорошо, уже решил. Проблема, связанная с файлом 9.png, не была разработана должным образом.

  • 0
    Можете ли вы уточнить, в чем проблема? Я сталкиваюсь с той же проблемой.
  • 1
    @Niels это простая проблема: вам просто нужно отредактировать вашу 9.png с помощью инструмента sdk. Вы должны поместить пиксели, которые будут содержать текст вниз и вправо.
Теги:
android-spinner
drawable
nine-patch

1 ответ

0
Лучший ответ

Текст внутри может быть белого цвета. Постарайтесь изменить цвет фона, чтобы быть уверенным...

  • 0
    Я уже пытался изменить цвета. На самом деле фон за пределами синего треугольника и нижней линии прозрачен. Я изменил цвет макета, содержащего счетчики, на черный и белый, и я не мог видеть текст.
  • 0
    Можете ли вы вставить код вашего адаптера?
Показать ещё 1 комментарий

Ещё вопросы

Сообщество Overcoder
Наверх
Меню