2017-04-14 4 views
-1

내 recyclerview와 imageslider 사이에 공백이 있습니다.recyclerview 항목 사이 공백

이 내 조각 레이아웃입니다 :

<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 - 또한 내가 아래로 항목을 스 와이프하면 이미지 라이더 아래에 숨어 있습니다. 할 일이 무엇입니까?

<?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 - 내가 뭘 잘못 했습니까 그래서 내 재활용보기 항목은 멀리있는 recyclerview의 항목을 표시 휴지통 레이아웃 :

은 내가

업데이트]를 도움이 필요하세요 분리 됐어?

custom_indicator2을 XML에서 제거하고 android:layout_marginBottom="20dp"custom_indicator에서 제거하십시오.

2 - 또한 아래쪽에서 항목을 스 와이프하여 이미지 라이더 아래에 숨 깁니다. 할 일이 무엇입니까?

app:layout_behavior="@string/appbar_scrolling_view_behavior"SwipeRefreshLayout에서 제거하십시오. 아래

업데이트하여 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> 

UPDATE : 나는 문제가 당신의 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

그것이 내가 내 질문을 편집하고 게시 할 예정입니다 t의 work..same 결과 을 didn를 죄송 내 항목을 표시하기위한 레이아웃 –

+0

오, 너와 함께 지겨워! 감사합니다. scrollview 문제였습니다. –