Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/199.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android全屏幕可视寻呼机_Android_Android Viewpager_Fullscreen - Fatal编程技术网

Android全屏幕可视寻呼机

Android全屏幕可视寻呼机,android,android-viewpager,fullscreen,Android,Android Viewpager,Fullscreen,我有以下android布局 <?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

我有以下android布局

<?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_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:gravity="center"
android:orientation="vertical"
android:background="#3f5561"
android:id="@+id/MainLayout">

<android.support.v4.view.ViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:layout_below="@+id/tabs" />

<com.astuetz.PagerSlidingTabStrip
    android:id="@+id/tabs"
    app:pstsShouldExpand="true"
    app:pstsTextAllCaps="true"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:background="#a97878"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_alignParentTop="true" />

如您所见,ViewPager周围有灰色,这是主布局的颜色。我的问题是,如何将ViewPager设置为全屏(没有主布局)。例如YouTube、PlayStore等。这就是我想要的样子


我怎么可能做到呢?我们将不胜感激

将左、右和顶部填充添加到容器中,这就是为什么会出现灰色区域。并没有底部填充,所以底部是好的

从您的
RelativeLayout

android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"

您添加了填充,这就是为什么它在周围显示主布局,删除填充以将ViewPager应用于整个屏幕