未在ListView的标题中显示LinearLayout样式

时间:2013-03-12 00:55:05

标签: android android-layout header android-listview styles

我有ListView标题。在此标头中,LinearLayout具有预定义的样式。问题是这种布局没有显示那种风格。

标题的代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    style="?blueHardBackground"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="5dip"
    android:layout_marginRight="5dip"
    android:layout_marginTop="2dp"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:orientation="horizontal" >

        <Spinner
            android:id="@+id/spinnerCiudad"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawSelectorOnTop="true" />

        <Spinner
            android:id="@+id/spinnerCategoria"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:drawSelectorOnTop="true" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/textNombreElemento"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:textSize="6pt"
            android:typeface="serif" >

            <requestFocus />
        </EditText>

        <ImageView
            android:id="@+id/botonFiltrar"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:contentDescription="Mostrar"
            android:src="@drawable/buscar_n" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/capaNumResultados"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/textNumResultados"
            style="?textRegular"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="" />
    </LinearLayout>

</LinearLayout>

它应该显示为带有圆角的蓝色中心,但它显示为透明,没有样式,左侧。

1 个答案:

答案 0 :(得分:1)

我相信你想要

style="?style/blueHardBackground">

LinearLayout而不是

style="?blueHardBackground">

你错过了“{”之后的style告诉xml在哪里查找名称blueHardBackground

This Link in the Docs 的 有关访问resources

的说明