2017-04-14 76 views
-1

我在我的回收站視圖和imageslider之間獲取空間。回收站視圖項目之間的空間

這是我的片段佈局:

<LinearLayout 
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" 
xmlns:custom="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<com.daimajia.slider.library.SliderLayout 
    android:id="@+id/slider" 
    android:layout_width="match_parent" 
    custom:pager_animation="Accordion" 
    custom:auto_cycle="true" 
    custom:indicator_visibility="visible" 
    custom:pager_animation_span="1100" 
    android:layout_height="200dp"/> 

<com.daimajia.slider.library.Indicators.PagerIndicator 
    android:id="@+id/custom_indicator" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    custom:selected_color="#0095BF" 
    custom:unselected_color="#55333333" 
    custom:shape="oval" 
    custom:selected_padding_left="5dp" 
    custom:selected_padding_right="5dp" 
    custom:unselected_padding_left="5dp" 
    custom:unselected_padding_right="5dp" 
    android:layout_centerHorizontal="true" 
    android:layout_alignParentBottom="true" 
    custom:selected_width="6dp" 
    custom:selected_height="6dp" 
    custom:unselected_width="6dp" 
    custom:unselected_height="6dp" 
    android:layout_marginBottom="20dp" 
    /> 
<com.daimajia.slider.library.Indicators.PagerIndicator 
    android:id="@+id/custom_indicator2" 
    style="@style/AndroidImageSlider_Corner_Oval_Orange" 
    android:layout_centerHorizontal="true" 
    android:layout_alignParentBottom="true" 
    android:layout_marginBottom="20dp"/> 


<android.support.v4.widget.SwipeRefreshLayout 
android:layout_below="@+id/custom_indicator" 
android:id="@+id/swipe_refresh" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

<android.support.v7.widget.RecyclerView 
    android:layout_below="@+id/custom_indicator" 
    android:id="@+id/recycler_post" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"/> 

[1]

1 - 我做了什麼錯了,所以我的[佈局] [1]!]回收商查看項目是遠隔?

2 - 同樣,當我從底部滑動項目他們隱藏在imageslider下面..要做什麼?

請我需要幫助

更新: 回收站佈局在recyclerview顯示項目

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

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.v7.widget.CardView 
     android:id="@+id/card_view" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:cardBackgroundColor="@color/Grey_50" 
     app:cardCornerRadius="0dp" 
     app:cardUseCompatPadding="true" 
     card_view:cardCornerRadius="dp"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <ImageView 
       android:id="@+id/image_news" 
       android:layout_width="70dp" 
       android:layout_height="50dp" 
       android:layout_alignParentEnd="true" 
       android:layout_alignParentRight="true" 
       android:layout_centerHorizontal="true" 
       android:layout_centerVertical="true" 
       android:scaleType="center" /> 

      <TextView 
       android:id="@+id/txt_news_title" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:layout_toLeftOf="@+id/image_news" 
       android:textSize="13sp" /> 
      <View 
       android:id="@+id/view1" 
       android:layout_below="@+id/image_news" 
       android:layout_width="match_parent" 
       android:layout_height="1dp" 
       android:layout_marginTop="10dp" 
       /> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal"> 


       <ImageView 
        android:id="@+id/recent" 
        android:layout_width="15dp" 
        android:layout_height="15dp" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentStart="true" 
        android:layout_alignParentTop="true" 
        android:layout_gravity="center" 
        android:layout_marginRight="2dp" 
        android:background="@drawable/ic_recent" 
        android:textAlignment="center" /> 


       <TextView 
        android:id="@+id/txt_timedate" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_alignParentTop="true" 
        android:layout_toEndOf="@+id/recent" 
        android:layout_toRightOf="@+id/recent" 
        android:text="20:49" 
        android:textColor="@color/Grey_600" 
        android:textSize="16sp" /> 
      </LinearLayout> 

     </RelativeLayout> 
    </android.support.v7.widget.CardView> 
</ScrollView> 

回答

1

1 - 我做了什麼錯了,所以我的回收站視圖中的項目遠分開嗎?

從XML中刪除custom_indicator2,還從custom_indicator中刪除屬性android:layout_marginBottom="20dp"

2 - 同樣,當我從底部滑動項目,他們隱藏在imageslider下面..做什麼?

SwipeRefreshLayout刪除屬性app:layout_behavior="@string/appbar_scrolling_view_behavior"

更新你的XML如下:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    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" 
    xmlns:custom="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <com.daimajia.slider.library.SliderLayout 
     android:id="@+id/slider" 
     android:layout_width="match_parent" 
     custom:pager_animation="Accordion" 
     custom:auto_cycle="true" 
     custom:indicator_visibility="visible" 
     custom:pager_animation_span="1100" 
     android:layout_height="200dp"/> 

    <com.daimajia.slider.library.Indicators.PagerIndicator 
     android:id="@+id/custom_indicator" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     custom:selected_color="#0095BF" 
     custom:unselected_color="#55333333" 
     custom:shape="oval" 
     custom:selected_padding_left="5dp" 
     custom:selected_padding_right="5dp" 
     custom:unselected_padding_left="5dp" 
     custom:unselected_padding_right="5dp" 
     android:layout_centerHorizontal="true" 
     android:layout_alignParentBottom="true" 
     custom:selected_width="6dp" 
     custom:selected_height="6dp" 
     custom:unselected_width="6dp" 
     custom:unselected_height="6dp"/> 

    <android.support.v4.widget.SwipeRefreshLayout 
     android:id="@+id/swipe_refresh" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recycler_post" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" /> 
    </android.support.v4.widget.SwipeRefreshLayout> 
</LinearLayout> 

更新:我認爲這個問題是在你recycler項目視圖。從項目佈局中刪除ScrollView

試試這個:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v7.widget.CardView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:card_view="http://schemas.android.com/tools" 
    android:id="@+id/card_view" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:cardBackgroundColor="@color/Grey_50" 
    app:cardCornerRadius="0dp" 
    app:cardUseCompatPadding="true" 
    card_view:cardCornerRadius="dp"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <ImageView 
      android:id="@+id/image_news" 
      android:layout_width="70dp" 
      android:layout_height="50dp" 
      android:layout_alignParentEnd="true" 
      android:layout_alignParentRight="true" 
      android:layout_centerHorizontal="true" 
      android:layout_centerVertical="true" 
      android:scaleType="center" /> 

     <TextView 
      android:id="@+id/txt_news_title" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_centerVertical="true" 
      android:layout_toLeftOf="@+id/image_news" 
      android:textSize="13sp" /> 
     <View 
      android:id="@+id/view1" 
      android:layout_below="@+id/image_news" 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:layout_marginTop="10dp" /> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal"> 

      <ImageView 
       android:id="@+id/recent" 
       android:layout_width="15dp" 
       android:layout_height="15dp" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true" 
       android:layout_alignParentTop="true" 
       android:layout_gravity="center" 
       android:layout_marginRight="2dp" 
       android:background="@drawable/ic_recent" 
       android:textAlignment="center" /> 

      <TextView 
       android:id="@+id/txt_timedate" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentTop="true" 
       android:layout_toEndOf="@+id/recent" 
       android:layout_toRightOf="@+id/recent" 
       android:text="20:49" 
       android:textColor="@color/Grey_600" 
       android:textSize="16sp" /> 
     </LinearLayout> 
    </RelativeLayout> 
</android.support.v7.widget.CardView> 

希望這將有助於〜

+0

我會嘗試... –

+0

對不起它奧斯卡最佳噸work..same結果 我將編輯我的問題,我的後佈局顯示項目 –

+0

哦,你已經厭倦了我的作品!謝謝你救了我,這是scrollview問題。 但是,如果你得到了一個解決方案,如果我從底部到頂部滑動reyclerview它仍然隱藏在imageslider下的項目 –

相關問題