如何在ViewPager圆形指示器中调整图像和文本



我正在尝试将ImageView和TextView放在ViewPager圆圈指示器中。我想在 Imageview 下面显示文本,但文本被带有圆形指示器的页脚隐藏。请建议如何在布局中调整其中三个。布局是:

查看寻呼机 :

 <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginBottom="1dp"
            android:layout_marginTop="1dp"
            android:layout_weight="0.8"
            android:background="@color/white"
            android:orientation="vertical" >
            <!-- ViewPager -->
            <android.support.v4.view.ViewPager
                android:id="@+id/viewPager"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" />
           <!-- Footer -->
        <include layout="@layout/footer"  />
        </FrameLayout>

带有圆形指示器的页脚:

<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:layout_gravity="bottom"
android:orientation="vertical" >
<Button android:layout_height="wrap_content" android:layout_width="wrap_content"
android:id="@+id/btn1" 
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/rounded_celll" />
 <Button android:layout_height="wrap_content" android:layout_width="wrap_content"
android:id="@+id/btn2"
android:layout_toRightOf="@id/btn1"
android:layout_marginLeft="5dip"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/rounded_celll" />
 </RelativeLayout>

这是将在ViewPager中显示的布局1:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical"
android:layout_gravity="top|center">
<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/sp1" 
    android:layout_weight="0.7"/>
<TextView
    android:id="@+id/textView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="10sp"
    android:layout_weight="0.3"
    android:textColor="@color/black"
    android:textStyle="bold"
    android:text="First Layout First Layout First Layout First Layout "
   /> 

Lets say as of now you have three layouts -
1) Main layout (which has view pager)
2) footer layout
3) layout having imageView and textView
To achieve your goal, you can do below steps -
 remove "<include layout="@layout/footer" from mail layout and add it as a part of 3) layout.
 This footer view will also be part of viewPager.

最新更新