【发布时间】:2016-06-16 19:02:39
【问题描述】:
我有一个活动,我有一些图像、文本视图、一个按钮和 viewpager。 Viewpager 具有与父级匹配的高度和宽度,并且所有布局的背景都为白色。现在,当活动加载时,viewpager 通过适配器获取其片段并加载片段。现在图像,文本视图隐藏在加载的片段后面,但按钮不会隐藏并且显示在片段中。为什么会这样?
这是我的活动布局,viewpager 作为最后一个元素
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.appointmentno.android.LogoFrontScreen"
android:background="@android:color/white"
android:keepScreenOn="true">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:id="@+id/rel_center_logo">
<ImageView
android:layout_width="@dimen/logo_width"
android:layout_height="@dimen/logo_height"
android:src="@drawable/finalc"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:id="@+id/img_logo_c"/>
<TextView
android:layout_width="210dp"
android:layout_height="wrap_content"
android:text="@string/logo_name"
android:layout_below="@id/img_logo_c"
android:id="@+id/app_name"
style="@style/RobotoTextViewStyle"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:textSize="@dimen/logo_text_size"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/logo_underline"
android:layout_below="@id/app_name"
android:id="@+id/app_name_underline"
style="@style/RobotoTextViewStyle"
android:textColor="@android:color/black"
android:textSize="13sp"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/txt_progress_report"
android:layout_below="@+id/rel_center_logo"
android:gravity="center"
android:layout_marginTop="50dp"
android:layout_centerHorizontal="true"
android:maxLines="10"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_2"
android:id="@+id/btn_enter_app"
android:layout_below="@id/rel_center_logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="84dp"/>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:id="@+id/logo_screen_progress"
android:layout_below="@id/rel_center_logo"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone"
android:background="@color/colorAccent"
android:textColor="@android:color/white"
android:id="@+id/txt_ver_alert"
android:gravity="center"/>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager_gallery"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>
</RelativeLayout>
【问题讨论】:
标签: android android-layout android-fragments android-viewpager