2016-03-26 2 views
-1

У меня есть некоторые проблемы с ViewPager Я использую. Я хочу, чтобы он был на полном экране, но почему-то есть некоторые ребра, которые не исчезнут. Как я могу это решить?Я хочу, чтобы ViewPager был в полноэкранном режиме - Android Studio

код из XML -file

<?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:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context=".Main.MainActivity" 
    tools:showIn="@layout/activity_main"> 

    <android.support.v4.view.ViewPager 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/viewPager" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" /> 
</RelativeLayout> 

enter image description here

+0

ОК, поэтому удалите прописку из родительского относительного макета и сделайте просмотр пейджером в качестве родительского элемента –

+0

Это сработало, спасибо! – thehulk

+0

вместо того, чтобы писать спасибо, вы можете перенести или принять ответ, который поможет решить проблему. –

ответ

0

Попробуйте удалить из Прокладки всех четырех сторон. По умолчанию при создании действия с использованием AS AS добавит дополнение к вашему основному виду. Ниже находится макет без внешней прокладки.

<?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" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context=".Main.MainActivity" 
    tools:showIn="@layout/activity_main"> 

    <android.support.v4.view.ViewPager 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/viewPager" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" /> 
</RelativeLayout> 
1

Вы можете попробовать это:

android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
0

Вы можете попробовать, как, как следующим образом

<?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" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context=".Main.MainActivity" 
tools:showIn="@layout/activity_main"> 

<android.support.v4.view.ViewPager 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/viewPager" 
    android:layout_centerVertical="true" 
    android:layout_centerHorizontal="true" /> 

0

удалить все андроида: обивка из RelativeLayout и удалить андроида: layout_centerVertical and android: layout_centerГоризонтально из ViewPager

Смежные вопросы