android ViewPager RelativeLayout的按钮是不可见的

时间:2013-11-26 07:32:24

标签: android button android-viewpager relativelayout invisible

** RelativeLayout是viewpager的视图之一。

按钮不可见任何项目或某些项目,但当Listview的项目填满屏幕时,该按钮是不可见的。**

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/rl_favorite"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@color/bg_color" >

        <com.wwtest.widget.pullToRefresh.PullToRefreshListView
            android:id="@+id/listview_favorite"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:descendantFocusability="blocksDescendants"
            android:divider="@drawable/solid_line"
            android:dividerHeight="1dip"
            android:scrollbars="none" >
        </com.wwtest.widget.pullToRefresh.PullToRefreshListView>

        <TextView
            android:id="@+id/tv_faHint"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:text="@+id/listview_favorite"
            android:textColor="@color/black"
            android:textSize="20sp"
            android:visibility="gone" />

        <Button
            android:id="@+id/btn_add"
            android:layout_width="fill_parent"
            android:layout_height="50dip"
            android:layout_below="@+id/listview_favorite"
            android:background="@drawable/btn_favorite_selector"
            android:gravity="center"
            android:text="add"
            android:textColor="@color/black"
            android:textSize="20sp"
            android:visibility="visible" />

    </RelativeLayout>

1 个答案:

答案 0 :(得分:0)

试试这个:

    

    <com.wwtest.widget.pullToRefresh.PullToRefreshListView
        android:id="@+id/listview_favorite"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:descendantFocusability="blocksDescendants"
        android:divider="@drawable/solid_line"
        android:dividerHeight="1dip"
        android:scrollbars="none" >
    </com.wwtest.widget.pullToRefresh.PullToRefreshListView>

    <TextView
        android:id="@+id/tv_faHint"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@+id/listview_favorite"
        android:textColor="@color/black"
        android:textSize="20sp"
        android:visibility="gone" />

    <Button
        android:id="@+id/btn_add"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:layout_alignParentBottom="true"
        android:background="@drawable/btn_favorite_selector"
        android:gravity="center"
        android:text="add"
        android:textColor="@color/black"
        android:textSize="20sp"
        android:visibility="visible" />

</RelativeLayout>