2017-04-14 91 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下的项目 –

相关问题