2015-12-16 3 views
4

У меня есть SwipeRefreshLayout внутри a RelativeLayout. Проблема в том, что SwipeRefreshLayout занимает все место на экране, и мне нужно поставить после этот вид.Настроить SwipeRefreshLayout высота до места Вид снизу

See picture: У меня: 1-й вид, мне нужно: 2-й вид в самом низу экрана, но с некоторым пространством наверху.

Мой образец XML является:

<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="wrap_content" 
    android:layout_height="wrap_content" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="ru.seniorsolutions.freelansim.Orders" 
    tools:showIn="@layout/app_bar_orders" 
    android:paddingTop="10dp" 
    android:id="@+id/layout_base"> 

    <android.support.v4.widget.SwipeRefreshLayout 
     android:id="@+id/refreshContainer" 
     android:layout_width="match_parent" 
     android:layout_height="450dp" 
     android:layout_marginBottom="30dp"> 
      <ListView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/lvOffers" 
       android:choiceMode="singleChoice" 
       android:fastScrollEnabled="false" /> 
    </android.support.v4.widget.SwipeRefreshLayout> 

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="horizontal" android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:paddingLeft="20dp" 
     android:paddingRight="20dp" 
     android:measureWithLargestChild="false" 
     android:layout_alignParentBottom="false" 
     android:layout_alignParentLeft="false" 
     android:layout_alignParentStart="false" 
     android:layout_alignParentEnd="true" 
     android:layout_alignBottom="@+id/refreshContainer"> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:text="prev" 
      android:id="@+id/tvPrevPage" 
      android:textColor="#5bb3ee" 
      android:textStyle="bold" /> 

     <View 
      android:layout_width="0dp" 
      android:layout_height="0dp" 
      android:layout_weight="1" /> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:text="next" 
      android:id="@+id/tvNextPage" 
      android:textColor="#5bb3ee" 
      android:textStyle="bold" /> 
    </LinearLayout> 

</RelativeLayout> 

ответ

4

дают android:layout_alignParentBottom="true" вашему LinearLayout

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_alignParentBottom="true 
    android:id="@+id/ll" 
    ..... 
</LinearLayout> 

и установить SwipeRefreshLayout над LinearLayout, а также дать свою высоту match_parent

<android.support.v4.widget.SwipeRefreshLayout 
    android:id="@+id/refreshContainer" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_above="@id/ll" 
    android:layout_marginBottom="30dp"> 
+0

Я буду попробуйте это прямо сейчас, спасибо! – MichaelOne

+0

выглядит так, как будто нужно, спасибо! – MichaelOne

+0

не хватает очков репутации :( – MichaelOne

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