搜索后的ListView焦点

时间:2018-01-30 10:10:19

标签: android listview scrollview

  

我在list view内使用scrollview时遇到问题。

在搜索之前创建屏幕时,我必须实现滚动视图,当我搜索结果时,列表视图会显示在顶部并且它变得非常小,所有它都与父级宽度和高度相匹配。我可以看到我不能在屏幕上使用多个滚动视图。那么如何在点击搜索按钮后设置列表项视图以匹配父项,我不需要主滚动视图

垂直布局:

    <?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/scroll"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.android.booklisting.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin"
    android:orientation="vertical"
android:id="@+id/searchlayout">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
<EditText
    android:id="@+id/rinkiklis"
    android:layout_width="@dimen/weighted"
    android:layout_height="wrap_content"
    android:layout_weight="7"/>
<Button
    android:foreground="?attr/selectableItemBackground"
    android:layout_width="@dimen/weighted"
    android:layout_height="@dimen/searchimage"
    android:layout_weight="1"
    android:background="@drawable/glass"
    android:id="@+id/searchButton"/></LinearLayout>
</LinearLayout>
<ProgressBar
    style="@style/Widget.AppCompat.ProgressBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/searchlayout"
    android:id="@+id/progress"
    android:visibility="gone"
    android:layout_centerInParent="true" />
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/mostpopular"
    android:layout_below="@+id/searchlayout">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Populiariausios knygos"
        android:textSize="@dimen/largeText"
        android:id="@+id/popular"
        android:textAlignment="center"/>
    <RelativeLayout
        android:layout_marginTop="@dimen/marginTopVerySmall"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/popular">

        <RelativeLayout
            android:layout_marginTop="@dimen/marginTopVerySmall"
            android:id="@+id/pirmaslayout"
            android:layout_width="@dimen/imageWidth"
            android:layout_height="@dimen/imageHeight"
            android:layout_alignParentTop="true"
            android:layout_alignStart="@+id/treciaslayout">

            <ImageView
                android:id="@+id/pirmas"
                style="@style/image"
                android:src="@drawable/primas" />

            <TextView
                style="@style/PictureTextview"
                android:text="@string/don_quixote" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="@dimen/imageWidth"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentTop="true"
            android:layout_marginEnd="@dimen/MarginEnd"
            android:id="@+id/antraslayout"
            android:layout_marginTop="@dimen/MarginTop">
        <ImageView
            android:id="@+id/antras"
            style="@style/image"
            android:src="@drawable/antras" />
        <TextView
            style="@style/PictureTextview"
            android:text="@string/a_tale_of_two_cities" />
    </RelativeLayout>
    <RelativeLayout
android:layout_width="@dimen/imageWidth"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/MarginTopSmall"
android:layout_marginLeft="@dimen/marginLeft"
android:layout_below="@+id/pirmaslayout"
android:id="@+id/treciaslayout">
    <ImageView
        android:layout_width="@dimen/imageWidth"
        android:layout_height="@dimen/imageHeight"
        android:id="@+id/trecias"
        android:src="@drawable/trecias"
        android:scaleType="centerCrop"/>
        <TextView
            style="@style/PictureTextview"
            android:text="@string/the_lord_of_the_rings"/>
    </RelativeLayout>
        <RelativeLayout
            android:layout_width="@dimen/imageWidth"
            android:layout_height="wrap_content"
            android:layout_alignStart="@+id/antraslayout"
            android:layout_below="@+id/antraslayout"
            android:layout_marginTop="32dp">
            <ImageView
                android:id="@+id/ketvirtas"
                style="@style/image"
                android:src="@drawable/ketvirtas" />
            <TextView
                style="@style/PictureTextview"
                android:text="@string/the_little_prince" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="@dimen/imageWidth"
            android:layout_height="wrap_content"
            android:layout_alignStart="@+id/treciaslayout"
            android:layout_below="@+id/treciaslayout"
            android:layout_marginTop="@dimen/MarginTopSmall"
            android:paddingBottom="@dimen/paddingbottom">

            <ImageView
                style="@style/image"
                android:id="@+id/penktas"
                android:src="@drawable/penktas" />

            <TextView
                style="@style/PictureTextview"
                android:text="@string/harry_potter" />
        </RelativeLayout>
    </RelativeLayout>
</RelativeLayout>
<LinearLayout
    android:id="@+id/linearlistlayout"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_below="@+id/searchlayout"
    android:orientation="vertical"
    android:visibility="visible">
    <TextView
        android:id="@+id/emptyview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_horizontal"
        android:visibility="gone" />
    <ListView
        android:id="@+id/listview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</LinearLayout>
</RelativeLayout>
</ScrollView>

横向布局:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout
    android:id="@+id/main_relative"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.android.booklisting.MainActivity">

    <LinearLayout
        android:id="@+id/searchlayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/margin"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <EditText
                android:id="@+id/rinkiklis"
                android:layout_width="@dimen/weighted"
                android:layout_height="wrap_content"
                android:layout_weight="10" />
            <LinearLayout
            android:layout_width="40dp"
            android:layout_height="40dp">
            <Button
                android:id="@+id/searchButton"
                android:layout_width="0dp"
                android:layout_height="@dimen/searchimage"
                android:layout_weight="1"
                android:background="@drawable/glass"
                android:foreground="?attr/selectableItemBackground" /> 
        </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <ProgressBar
        android:id="@+id/progress"
        style="@style/Widget.AppCompat.ProgressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/searchlayout"
        android:layout_centerInParent="true"
        android:visibility="gone" />

    <RelativeLayout
        android:id="@+id/mostpopular"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/searchlayout">

        <TextView
            android:id="@+id/popular"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Populiariausios knygos"
            android:textAlignment="center"
            android:textSize="@dimen/largeText" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/popular"
            android:layout_marginTop="@dimen/marginTopVerySmall">

            <RelativeLayout
                android:id="@+id/pirmaslayout"
                android:layout_width="@dimen/imageWidth"
                android:layout_height="@dimen/imageHeight"
                android:layout_alignParentTop="true"
                android:layout_alignStart="@+id/treciaslayout"
                android:layout_marginTop="@dimen/marginTopVerySmall">

                <ImageView
                    android:id="@+id/pirmas"
                    style="@style/image"
                    android:src="@drawable/primas" />

                <TextView
                      style="@style/PictureTextview"
                      android:text="@string/don_quixote" />
              </RelativeLayout>
              <RelativeLayout
                android:id="@+id/antraslayout"
                android:layout_width="@dimen/imageWidth"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentTop="true"
                android:layout_marginEnd="@dimen/MarginEnd"
                android:layout_marginTop="@dimen/MarginTop">

                <ImageView
                    android:id="@+id/antras"
                    style="@style/image"
                    android:src="@drawable/antras" />

                <TextView
                    style="@style/PictureTextview"
                    android:text="@string/a_tale_of_two_cities" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/treciaslayout"
                android:layout_width="@dimen/imageWidth"
                android:layout_height="wrap_content"
                android:layout_below="@+id/pirmaslayout"
                android:layout_marginLeft="@dimen/marginLeft"
                android:layout_marginTop="@dimen/MarginTopSmall">

                <ImageView
                    android:id="@+id/trecias"
                    android:layout_width="@dimen/imageWidth"
                    android:layout_height="@dimen/imageHeight"
                    android:scaleType="centerCrop"
                    android:src="@drawable/trecias" />

                <TextView
                    style="@style/PictureTextview"
                    android:text="@string/the_lord_of_the_rings" />
            </RelativeLayout>

            <RelativeLayout
                android:layout_width="@dimen/imageWidth"
                android:layout_height="wrap_content"
                android:layout_alignStart="@+id/antraslayout"
                android:layout_below="@+id/antraslayout"
                android:layout_marginTop="32dp">

                <ImageView
                    android:id="@+id/ketvirtas"
                    style="@style/image"
                    android:src="@drawable/ketvirtas" />

                <TextView
                    style="@style/PictureTextview"
                    android:text="@string/the_little_prince" />
            </RelativeLayout>

            <RelativeLayout
                android:layout_width="@dimen/imageWidth"
                android:layout_height="wrap_content"
                android:layout_alignStart="@+id/treciaslayout"
                android:layout_below="@+id/treciaslayout"
                android:layout_marginTop="@dimen/MarginTopSmall"
                android:paddingBottom="@dimen/paddingbottom">

                <ImageView
                    android:id="@+id/penktas"
                    style="@style/image"
                    android:src="@drawable/penktas" />

                <TextView
                    style="@style/PictureTextview"
                    android:text="@string/harry_potter" />
            </RelativeLayout>
        </RelativeLayout>
    </RelativeLayout>

    <LinearLayout
        android:id="@+id/linearlistlayout"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_below="@+id/searchlayout"
        android:orientation="vertical"
        android:visibility="visible">

        <TextView
            android:id="@+id/emptyview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            android:visibility="gone" />

        <ListView
            android:id="@+id/listview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    </LinearLayout>
</RelativeLayout>
</ScrollView>

Github link

Screenshots

1 个答案:

答案 0 :(得分:0)

我将主要的scrool视图从顶部移动到了一个相对布局,我不想开始滚动。

更改了代码lile:

垂直布局:

        <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.android.booklisting.MainActivity">
    <ProgressBar
    style="@style/Widget.AppCompat.ProgressBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/progress"
    android:visibility="gone"
    android:layout_centerInParent="true" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/mainlinear">


        <ScrollView
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:id="@+id/scroll"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:descendantFocusability="beforeDescendants"
                android:focusableInTouchMode="true">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="@dimen/margin"
                    android:orientation="vertical"
                    android:id="@+id/searchlayout"
                    android:descendantFocusability="beforeDescendants"
                    android:focusableInTouchMode="true">
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:descendantFocusability="beforeDescendants"
                        android:focusableInTouchMode="true">
                        <EditText
                            android:id="@+id/rinkiklis"
                            android:layout_width="@dimen/weighted"
                            android:imeOptions="actionSearch"
                            android:layout_height="wrap_content"
                            android:layout_weight="7"
                            android:inputType="textPersonName"
                         />
                        <Button
                            android:foreground="?attr/selectableItemBackground"
                            android:layout_width="@dimen/weighted"
                            android:layout_height="@dimen/searchimage"
                            android:layout_weight="1"
                            android:background="@drawable/glass"
                            android:id="@+id/searchButton"/></LinearLayout>
                </LinearLayout>

     <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/mostpopular">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Populiariausios knygos"
            android:textSize="@dimen/largeText"
            android:id="@+id/popular"
            android:textAlignment="center"/>
        <RelativeLayout
            android:layout_marginTop="@dimen/marginTopVerySmall"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/popular">

            <RelativeLayout
                android:layout_marginTop="@dimen/marginTopVerySmall"
                android:id="@+id/pirmaslayout"
                android:layout_width="@dimen/imageWidth"
                android:layout_height="@dimen/imageHeight"
                android:layout_alignParentTop="true"
                android:layout_alignStart="@+id/treciaslayout">

                <ImageView
                    android:id="@+id/pirmas"
                    style="@style/image"
                    android:src="@drawable/primas" />

                <TextView
                    style="@style/PictureTextview"
                    android:text="@string/don_quixote" />
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="@dimen/imageWidth"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentTop="true"
                android:layout_marginEnd="@dimen/MarginEnd"
                android:id="@+id/antraslayout"
                android:layout_marginTop="@dimen/MarginTop">
            <ImageView
                android:id="@+id/antras"
                style="@style/image"
                android:src="@drawable/antras" />
            <TextView
                style="@style/PictureTextview"
                android:text="@string/a_tale_of_two_cities" />
        </RelativeLayout>
        <RelativeLayout
        android:layout_width="@dimen/imageWidth"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/MarginTopSmall"
        android:layout_marginLeft="@dimen/marginLeft"
        android:layout_below="@+id/pirmaslayout"
        android:id="@+id/treciaslayout">
        <ImageView
            android:layout_width="@dimen/imageWidth"
            android:layout_height="@dimen/imageHeight"
            android:id="@+id/trecias"
            android:src="@drawable/trecias"
            android:scaleType="centerCrop"/>
            <TextView
                style="@style/PictureTextview"
                android:text="@string/the_lord_of_the_rings"/>
        </RelativeLayout>
            <RelativeLayout
                android:layout_width="@dimen/imageWidth"
                android:layout_height="wrap_content"
                android:layout_alignStart="@+id/antraslayout"
                android:layout_below="@+id/antraslayout"
                android:layout_marginTop="32dp">
                <ImageView
                    android:id="@+id/ketvirtas"
                    style="@style/image"
                    android:src="@drawable/ketvirtas" />
                <TextView
                    style="@style/PictureTextview"
                    android:text="@string/the_little_prince" />
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="@dimen/imageWidth"
                android:layout_height="wrap_content"
                android:layout_alignStart="@+id/treciaslayout"
                android:layout_below="@+id/treciaslayout"
                android:layout_marginTop="@dimen/MarginTopSmall"
                android:paddingBottom="@dimen/paddingbottom">

                <ImageView
                    style="@style/image"
                    android:id="@+id/penktas"
                    android:src="@drawable/penktas" />

                <TextView
                    style="@style/PictureTextview"
                    android:text="@string/harry_potter" />
            </RelativeLayout>
        </RelativeLayout>
    </RelativeLayout>
            </LinearLayout>
        </ScrollView>
    </LinearLayout>
    <LinearLayout
        android:id="@+id/linearlistlayout"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_below="@+id/mainlinear"
        android:orientation="vertical"
        android:visibility="visible">
        <TextView
            android:id="@+id/emptyview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="visible" />
        <ListView
            android:id="@+id/listview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    </LinearLayout>
    </RelativeLayout>

水平:

      <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.android.booklisting.MainActivity">
    <ProgressBar
        style="@style/Widget.AppCompat.ProgressBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/progress"
        android:visibility="gone"
        android:layout_centerInParent="true" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/mainlinear">


        <ScrollView
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:id="@+id/scroll"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:descendantFocusability="beforeDescendants"
                android:focusableInTouchMode="true">
                <LinearLayout
                    android:layout_marginTop="@dimen/marginTopVerySmall"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:descendantFocusability="beforeDescendants"
                    android:focusableInTouchMode="true">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <EditText
                    android:id="@+id/rinkiklis"
                    android:layout_width="@dimen/weighted"
                    android:imeOptions="actionSearch"
                    android:layout_height="wrap_content"
                    android:inputType="textPersonName"
                    android:layout_weight="10" />
                <LinearLayout
                android:layout_width="40dp"
                android:layout_height="40dp">
                <Button
                    android:id="@+id/searchButton"
                    android:layout_width="0dp"
                    android:layout_height="@dimen/searchimage"
                    android:layout_weight="1"
                    android:background="@drawable/glass"
                    android:foreground="?attr/selectableItemBackground" /></LinearLayout>
            </LinearLayout>
        </LinearLayout>
                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/mostpopular"
                    >
                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="Populiariausios knygos"
                        android:textSize="@dimen/largeText"
                        android:id="@+id/popular"
                        android:textAlignment="center"/>
                    <RelativeLayout
                        android:layout_marginTop="@dimen/marginTopVerySmall"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/popular">

                        <RelativeLayout
                            android:layout_marginTop="@dimen/marginTopVerySmall"
                            android:id="@+id/pirmaslayout"
                            android:layout_width="@dimen/imageWidth"
                            android:layout_height="@dimen/imageHeight"
                            android:layout_alignParentTop="true"
                            android:layout_alignStart="@+id/treciaslayout">

                            <ImageView
                                android:id="@+id/pirmas"
                                style="@style/image"
                                android:src="@drawable/primas" />

                            <TextView
                                style="@style/PictureTextview"
                                android:text="@string/don_quixote" />
                        </RelativeLayout>
                        <RelativeLayout
                            android:layout_width="@dimen/imageWidth"
                            android:layout_height="wrap_content"
                            android:layout_alignParentEnd="true"
                            android:layout_alignParentTop="true"
                            android:layout_marginEnd="@dimen/MarginEnd"
                            android:id="@+id/antraslayout"
                            android:layout_marginTop="@dimen/MarginTop">
                            <ImageView
                                android:id="@+id/antras"
                                style="@style/image"
                                android:src="@drawable/antras" />
                            <TextView
                                style="@style/PictureTextview"
                                android:text="@string/a_tale_of_two_cities" />
                        </RelativeLayout>
                        <RelativeLayout
                            android:layout_width="@dimen/imageWidth"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="@dimen/MarginTopSmall"
                            android:layout_marginLeft="@dimen/marginLeft"
                            android:layout_below="@+id/pirmaslayout"
                            android:id="@+id/treciaslayout">
                            <ImageView
                                android:layout_width="@dimen/imageWidth"
                                android:layout_height="@dimen/imageHeight"
                                android:id="@+id/trecias"
                                android:src="@drawable/trecias"
                                android:scaleType="centerCrop"/>
                            <TextView
                                style="@style/PictureTextview"
                                android:text="@string/the_lord_of_the_rings"/>
                        </RelativeLayout>
                        <RelativeLayout
                            android:layout_width="@dimen/imageWidth"
                            android:layout_height="wrap_content"
                            android:layout_alignStart="@+id/antraslayout"
                            android:layout_below="@+id/antraslayout"
                            android:layout_marginTop="32dp">
                            <ImageView
                                android:id="@+id/ketvirtas"
                                style="@style/image"
                                android:src="@drawable/ketvirtas" />
                            <TextView
                                style="@style/PictureTextview"
                                android:text="@string/the_little_prince" />
                        </RelativeLayout>
                        <RelativeLayout
                            android:layout_width="@dimen/imageWidth"
                            android:layout_height="wrap_content"
                            android:layout_alignStart="@+id/treciaslayout"
                            android:layout_below="@+id/treciaslayout"
                            android:layout_marginTop="@dimen/MarginTopSmall"
                            android:paddingBottom="@dimen/paddingbottom">

                            <ImageView
                                style="@style/image"
                                android:id="@+id/penktas"
                                android:src="@drawable/penktas" />

                            <TextView
                                style="@style/PictureTextview"
                                android:text="@string/harry_potter" />
                        </RelativeLayout>
                    </RelativeLayout>
                </RelativeLayout>
            </LinearLayout>
        </ScrollView>
    </LinearLayout>
    <LinearLayout
        android:id="@+id/linearlistlayout"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_below="@+id/mainlinear"
        android:orientation="vertical"
        android:visibility="visible">
        <TextView
            android:id="@+id/emptyview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="visible" />
        <ListView
            android:id="@+id/listview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
    </LinearLayout>
    </RelativeLayout>