簡體   English   中英

在ListView的標題中不顯示LinearLayout樣式

[英]Not showing LinearLayout style in a ListView's header

我有一個帶標題的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>

它應該以帶有圓角的藍色顯示為中心,但是在左側顯示為透明,沒有樣式。

我相信你想要

style="?style/blueHardBackground">

在您的LinearLayout而不是

style="?blueHardBackground">

您在“?”之后缺少style嗎? 告訴xml在哪里尋找名稱blueHardBackground

文檔中的此鏈接說明了有關訪問resources

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM