0

首先,列表视图消失了,然后当我单击按钮时它变为可见,但我仅在具有 Android 3.1 的移动设备中出现此错误,列表视图未显示。我尝试使用 cachecolorhint #00000000 但它不起作用。我目前正在使用 Xamarin 进行开发。

错误图片:http: //i471.photobucket.com/albums/rr77/lithium1818/Android_20140924.png

C#代码:

 public void VisibilidadBloqueResultado(bool visible)
        {
            resultado.Visibility = visible == true ? ViewStates.Visible : ViewStates.Gone;
        }

设置 listVisible 后,我设置了 de Adapter

adapter = new ListVisitaEmpresasAdapter(atx1, lista);
        empresas.Adapter = adapter;
        empresas.ItemClick += empresas_ItemClick;

XML 代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:p1="http://schemas.android.com/apk/res/android"
    p1:orientation="vertical"
    p1:minWidth="25px"
    p1:minHeight="25px"
    p1:layout_width="300dip"
    p1:layout_height="wrap_content"
    p1:id="@+id/linearLayout1"
    p1:paddingTop="5dip"
    p1:paddingRight="5dip"
    p1:paddingBottom="5dip"
    p1:paddingLeft="5dip">
    <LinearLayout
        p1:orientation="horizontal"
        p1:minWidth="25px"
        p1:minHeight="25px"
        p1:layout_width="match_parent"
        p1:layout_height="wrap_content"
        p1:id="@+id/linearLayout2"
        p1:background="@color/portada">
        <TextView
            p1:text="Programar Visita"
            p1:textAppearance="?android:attr/textAppearanceLarge"
            p1:layout_width="300dip"
            p1:layout_height="match_parent"
            p1:id="@+id/txt_titulo"
            p1:gravity="center_vertical"
            p1:paddingRight="10dip"
            p1:textColor="#FFFFFF"
            p1:paddingLeft="10dip"
            p1:textStyle="bold" />
    </LinearLayout>
    <ScrollView
        p1:minWidth="25px"
        p1:minHeight="25px"
        p1:layout_width="match_parent"
        p1:layout_height="match_parent"
        p1:id="@+id/scrollView1">
        <LinearLayout
            p1:orientation="vertical"
            p1:minWidth="25px"
            p1:minHeight="25px"
            p1:layout_width="match_parent"
            p1:layout_height="match_parent"
            p1:id="@+id/linearLayout10"
            p1:background="@color/fondo">
            <LinearLayout
                p1:orientation="vertical"
                p1:layout_width="match_parent"
                p1:layout_height="wrap_content"
                p1:id="@+id/Block_Descripcion">
                <WebView
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/web_content"
                    p1:minHeight="1dip" />
            </LinearLayout>
            <LinearLayout
                p1:orientation="vertical"
                p1:minWidth="25px"
                p1:minHeight="25px"
                p1:layout_width="match_parent"
                p1:layout_height="wrap_content"
                p1:id="@+id/lay_seleccion">
                <LinearLayout
                    p1:orientation="horizontal"
                    p1:minWidth="25px"
                    p1:minHeight="25px"
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/linearLayout4">
                    <TextView
                        p1:text="Ruta: "
                        p1:textAppearance="?android:attr/textAppearanceMedium"
                        p1:layout_width="wrap_content"
                        p1:layout_height="match_parent"
                        p1:id="@+id/textView1"
                        p1:textColor="#000000"
                        p1:gravity="center_vertical"
                        p1:textStyle="bold" />
                    <Spinner
                        p1:layout_width="match_parent"
                        p1:layout_height="match_parent"
                        p1:id="@+id/sp_zona" />
                </LinearLayout>
                <LinearLayout
                    p1:orientation="vertical"
                    p1:minWidth="25px"
                    p1:minHeight="25px"
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/linearLayout5"
                    p1:layout_marginTop="5dip"
                    p1:layout_marginBottom="2dip">
                    <EditText
                        p1:layout_width="match_parent"
                        p1:layout_height="wrap_content"
                        p1:id="@+id/edt_buscar"
                        p1:hint="No. Cliente o Nombre " />
                </LinearLayout>
                <LinearLayout
                    p1:orientation="vertical"
                    p1:minWidth="25px"
                    p1:minHeight="25px"
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/linearLayout7">
                    <Button
                        p1:text="Buscar"
                        p1:layout_width="wrap_content"
                        p1:layout_height="wrap_content"
                        p1:id="@+id/btn_search"
                        p1:layout_gravity="right"
                        p1:textColor="#000000"
                        p1:textStyle="bold"
                        p1:layout_marginRight="5dip" />
                </LinearLayout>
            </LinearLayout>
            <LinearLayout
                p1:orientation="vertical"
                p1:minWidth="25px"
                p1:minHeight="25px"
                p1:layout_width="match_parent"
                p1:layout_height="wrap_content"
                p1:id="@+id/lay_progress"
                p1:visibility="gone">
                <ProgressBar
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/progressBar1" />
                <TextView
                    p1:text="Obteniendo resultados..."
                    p1:textAppearance="?android:attr/textAppearanceSmall"
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/textView2"
                    p1:gravity="center_horizontal"
                    p1:textColor="#000000" />
            </LinearLayout>
        </LinearLayout>
    </ScrollView>
    <LinearLayout
        p1:orientation="vertical"
        p1:minWidth="25px"
        p1:minHeight="25px"
        p1:layout_width="match_parent"
        p1:layout_height="wrap_content"
        p1:id="@+id/lay_resultados"
        p1:visibility="gone"
        p1:background="@color/fondocobranza">
        <LinearLayout
            p1:orientation="horizontal"
            p1:minWidth="25px"
            p1:minHeight="25px"
            p1:layout_width="match_parent"
            p1:layout_height="wrap_content"
            p1:id="@+id/linearLayout9">
            <Button
                p1:text="Modificar"
                p1:layout_width="wrap_content"
                p1:layout_height="match_parent"
                p1:id="@+id/btn_modificar"
                p1:textColor="#000000"
                p1:textStyle="bold" />
            <EditText
                p1:layout_width="match_parent"
                p1:layout_height="match_parent"
                p1:id="@+id/edt_filter"
                p1:hint="Filtar resultados"
                p1:layout_marginLeft="3dip" />
        </LinearLayout>
        <ListView
            p1:minWidth="25px"
            p1:minHeight="25px"
            p1:layout_width="match_parent"
            p1:layout_height="match_parent"
            p1:id="@+id/list_empresas"
            p1:cacheColorHint="#00000000" />
    </LinearLayout>
</LinearLayout>
4

1 回答 1

0

我只是将列表的 LinearLayout 移动到 ScrollView 之前,它在这里完美运行是最终 XML。

XML 代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:p1="http://schemas.android.com/apk/res/android"
    p1:orientation="vertical"
    p1:minWidth="25px"
    p1:minHeight="25px"
    p1:layout_width="300dip"
    p1:layout_height="wrap_content"
    p1:id="@+id/linearLayout1"
    p1:paddingTop="5dip"
    p1:paddingRight="5dip"
    p1:paddingBottom="5dip"
    p1:paddingLeft="5dip">
    <LinearLayout
        p1:orientation="horizontal"
        p1:minWidth="25px"
        p1:minHeight="25px"
        p1:layout_width="match_parent"
        p1:layout_height="wrap_content"
        p1:id="@+id/linearLayout2"
        p1:background="@color/portada">
        <TextView
            p1:text="Programar Visita"
            p1:textAppearance="?android:attr/textAppearanceLarge"
            p1:layout_width="300dip"
            p1:layout_height="match_parent"
            p1:id="@+id/txt_titulo"
            p1:gravity="center_vertical"
            p1:paddingRight="10dip"
            p1:textColor="#FFFFFF"
            p1:paddingLeft="10dip"
            p1:textStyle="bold" />
    </LinearLayout>
    <LinearLayout
        p1:orientation="vertical"
        p1:minWidth="25px"
        p1:minHeight="25px"
        p1:layout_width="match_parent"
        p1:layout_height="wrap_content"
        p1:id="@+id/lay_resultados"
        p1:background="@color/fondocobranza"
        p1:visibility="gone">
        <LinearLayout
            p1:orientation="horizontal"
            p1:minWidth="25px"
            p1:minHeight="25px"
            p1:layout_width="match_parent"
            p1:layout_height="wrap_content"
            p1:id="@+id/linearLayout9">
            <Button
                p1:text="Modificar"
                p1:layout_width="wrap_content"
                p1:layout_height="match_parent"
                p1:id="@+id/btn_modificar"
                p1:textColor="#000000"
                p1:textStyle="bold" />
            <EditText
                p1:layout_width="match_parent"
                p1:layout_height="match_parent"
                p1:id="@+id/edt_filter"
                p1:hint="Filtar resultados"
                p1:layout_marginLeft="3dip" />
        </LinearLayout>
        <ListView
            p1:minWidth="25px"
            p1:minHeight="25px"
            p1:layout_width="match_parent"
            p1:layout_height="match_parent"
            p1:id="@+id/list_empresas"
            p1:cacheColorHint="#00000000" />
    </LinearLayout>
    <ScrollView
        p1:layout_width="match_parent"
        p1:layout_height="match_parent"
        p1:id="@+id/scrollView1">
        <LinearLayout
            p1:orientation="vertical"
            p1:layout_width="match_parent"
            p1:layout_height="match_parent"
            p1:id="@+id/linearLayout10"
            p1:background="@color/fondo">
            <LinearLayout
                p1:orientation="vertical"
                p1:layout_width="match_parent"
                p1:layout_height="wrap_content"
                p1:id="@+id/Block_Descripcion">
                <WebView
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/web_content"
                    p1:minHeight="1dip" />
            </LinearLayout>
            <LinearLayout
                p1:orientation="vertical"
                p1:minWidth="25px"
                p1:minHeight="25px"
                p1:layout_width="match_parent"
                p1:layout_height="wrap_content"
                p1:id="@+id/lay_seleccion">
                <LinearLayout
                    p1:orientation="horizontal"
                    p1:minWidth="25px"
                    p1:minHeight="25px"
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/linearLayout4">
                    <TextView
                        p1:text="Ruta: "
                        p1:textAppearance="?android:attr/textAppearanceMedium"
                        p1:layout_width="wrap_content"
                        p1:layout_height="match_parent"
                        p1:id="@+id/textView1"
                        p1:textColor="#000000"
                        p1:gravity="center_vertical"
                        p1:textStyle="bold" />
                    <Spinner
                        p1:layout_width="match_parent"
                        p1:layout_height="match_parent"
                        p1:id="@+id/sp_zona" />
                </LinearLayout>
                <LinearLayout
                    p1:orientation="vertical"
                    p1:minWidth="25px"
                    p1:minHeight="25px"
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/linearLayout5"
                    p1:layout_marginTop="5dip"
                    p1:layout_marginBottom="2dip">
                    <EditText
                        p1:layout_width="match_parent"
                        p1:layout_height="wrap_content"
                        p1:id="@+id/edt_buscar"
                        p1:hint="No. Cliente o Nombre " />
                </LinearLayout>
                <LinearLayout
                    p1:orientation="vertical"
                    p1:minWidth="25px"
                    p1:minHeight="25px"
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/linearLayout7">
                    <Button
                        p1:text="Buscar"
                        p1:layout_width="wrap_content"
                        p1:layout_height="wrap_content"
                        p1:id="@+id/btn_search"
                        p1:layout_gravity="right"
                        p1:textColor="#000000"
                        p1:textStyle="bold"
                        p1:layout_marginRight="5dip" />
                </LinearLayout>
            </LinearLayout>
            <LinearLayout
                p1:orientation="vertical"
                p1:minWidth="25px"
                p1:minHeight="25px"
                p1:layout_width="match_parent"
                p1:layout_height="wrap_content"
                p1:id="@+id/lay_progress"
                p1:visibility="gone">
                <ProgressBar
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/progressBar1" />
                <TextView
                    p1:text="Obteniendo resultados..."
                    p1:textAppearance="?android:attr/textAppearanceSmall"
                    p1:layout_width="match_parent"
                    p1:layout_height="wrap_content"
                    p1:id="@+id/textView2"
                    p1:gravity="center_horizontal"
                    p1:textColor="#000000" />
            </LinearLayout>
        </LinearLayout>
    </ScrollView>
</LinearLayout>
于 2014-09-24T19:34:17.963 回答