2014-12-03 2 views
0

У меня есть следующий макет:Scrollview с ViewPager

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#dddddd"> 

<LinearLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

<TextView android:id="@+id/title" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    android:text="title" 
    android:textSize="@dimen/checkout_title" 
    android:textColor="#858585" /> 

    <ViewPager 
     android:id="@+id/pager_checkout" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"/> 

    <CirclePageIndicator android:id="@+id/indicator_checkout" 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    app:pageColor="#858585" 
    app:fillColor="#f19201" /> 

    <TextView 
      android:id="@+id/name" 
      android:layout_below="@+id/title" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="20dp" 
      android:text="name" 
      android:textSize="16sp" /> 

     <EditText 
      android:id="@+id/editTextName" 
      android:layout_width="fill_parent" 
      android:layout_height="40dp" 
     android:paddingLeft="10dp" 
      android:paddingRight="10dp" /> 
     </LinearLayout> 
     </ScrollView> 
     </RelativeLayout> 

вид пейджера использует фрагменты в виде страниц (каждая страница содержит одно изображение) Херес Компоновка:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:background="#ff0000" > 

<ImageView 
android:id="@+id/img" 
android:layout_height="wrap_content" 
android:scaleType="centerInside" 
android:adjustViewBounds="true" 
android:layout_width="fill_parent" 
android:src="@drawable/img" /> 
</LinearLayout> 

мой главный вопрос заключается в том, что есть большое пространство между представлением пейджера и индикатором в таких устройствах, как nexus 4 в nexus 7 theres, не является пространством, так или иначе, чтобы удалить это пространство?

ответ

0

Попробуйте использовать Android: layout_marginTop определить место, вы хотите между ViewPager и индикатором

<ViewPager 
    android:id="@+id/pager_checkout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 

<CirclePageIndicator android:id="@+id/indicator_checkout" 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    app:pageColor="#858585" 
    app:fillColor="#f19201" 
    android:layout_marginTop="10dp"/>   <!-- 10dp spacing --> 
Смежные вопросы