2017-12-20 18 views
0

내 활동에 대한 의견을 정리하는 데 어려움을 겪고 있습니다.
나는 간단한 효과에 도달 할 :/숨기기 작업을 보여줄 수있을 것입니다 일부 텍스트보기 및 라디오와스크롤 레이아웃과 필터 패널로보기 배치

  • 필터 컨테이너를
  • 아래
  • : 사진의 큰 양 그리드보기

물론 사용자가 스크롤하여 모든 사진을 보여줄 수 있도록 내보기를 스크롤 가능하게 만들고 싶습니다.
게다가 필자는 필터의 위치를 ​​고정시키고 싶습니다.

원하는 레이아웃입니다.

enter image description here

나는 다음과 같은 방법으로 일을하려고했다 :
<android.support.constraint.ConstraintLayout 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" 
    tools:context="..." 
    android:id="@+id/allViews"> 

    <!-- panel with some filter controls --> 
    <LinearLayout 
     android:id="@+id/searchOpts" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     app:layout_constraintTop_toTopOf="parent" 
     android:layout_marginTop="@dimen/search_opts_margin" 
     android:visibility="gone" 
     android:orientation="vertical"> 

     <RadioGroup 
      android:id="@+id/sortOrder" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintRight_toRightOf="parent" 
      android:orientation="horizontal"> 

      <RadioButton 
       android:id="@+id/orderByTime" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"/> 

      <RadioButton 
       android:id="@+id/orderByRating" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"/> 
     </RadioGroup> 

     <MultiAutoCompleteTextView 
      android:id="@+id/tags" 
      android:hint="@string/tags_label" 
      android:layout_width="300dp" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="5dp" 
      android:inputType="textNoSuggestions|textCapSentences|textMultiLine" 
      android:textSize="16sp" 
      android:textColor="#555" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/sortOrder" /> 

    </LinearLayout> 

    <!-- panel with grid of big amount of images --> 
    <ScrollView 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_marginBottom="5dp" 
     android:id="@+id/sv" 
     android:layout_width="match_parent" 
     android:layout_marginTop="@dimen/items_grid_margin_under_search_opts" 
     app:layout_constraintTop_toBottomOf="@+id/searchOpts" 
     android:layout_height="match_parent" > 

     <GridView 
      android:id="@+id/PhotosGrid" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="5dp" 
      android:layout_marginRight="5dp" 
      android:columnWidth="100dp" 
      android:drawSelectorOnTop="true" 
      android:gravity="center" 
      android:numColumns="auto_fit" 
      android:verticalSpacing="5dp" 
      android:horizontalSpacing="5dp" 
      android:focusable="true" 
      android:clickable="true"/> 
    </ScrollView> 
</android.support.constraint.ConstraintLayout> 

은 불행히도 실패와 약간의 도움이 필요합니다.

+0

달성되었다 & 어떤 도움이 원하는 무엇? – Akhil

+0

Grid에 ScrollView가 필요하지 않습니다. 이미 스크롤 할 수 있습니다. 스크롤 할 수있는 항목이 더 많은 경우 자동으로 스크롤됩니다. – elmorabea

+0

먼저 스크롤 막대보기가 필터 패널과 겹칩니다. : app : layout_constraintTop_toBottomOf = "@ + id/searchOpts" – pumbosha

답변

1

나는 당신이 CoordinatorLayout를 사용하여이 작업을 수행 할 수 있다고 생각하고, 당신은 것입니다 :

  1. CoordinatorLayout를 레이아웃의 루트로.
  2. 코디네이터 레이아웃의 첫 번째 하위 항목으로 AppBarLayout.
  3. 툴바 및/또는 레이아웃/사용자 정의보기가있는 CollapsingToolbar를 추가하여 레이아웃의 상단 부분을 나타냅니다. CollapsingToolbarLayout을 사용하면 내용의 하단 부분이 스크롤을 시작할 때 트리거되는 툴바 및/또는 레이아웃에 대한 스크롤 동작을 정의 할 수 있습니다.
  4. 모의 작업의 하단 부분에 그리드를 표시하고 레이아웃 바 동을 지정하여 앱 바 레이아웃 안에서 물건을 제대로 스크롤 할 수 있도록 Recyclerview를 추가하십시오. 여기

는 레이아웃의 모습 방법의 예입니다 :

<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar_layout" 
     android:layout_width="match_parent" 
     android:layout_height="280dp" 
     android:fitsSystemWindows="true"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:layout_width="match_parent" 
      android:id="@+id/collapsingToolbar" 
      android:layout_height="280dp" 
      app:layout_scrollFlags="scroll|snap|exitUntilCollapsed" 
      app:contentScrim="?attr/colorPrimary"> 

      <CustomViewHeader 
       android:id="@+id/custom_view_header" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:scaleType="centerCrop" 
       app:layout_scrollFlags="scroll" 
       android:fitsSystemWindows="true"/> 

      <android.support.v7.widget.Toolbar 
       android:layout_height="?attr/actionBarSize" 
       android:layout_width="match_parent" 
       android:id="@+id/toolbar" 
       app:navigationIcon="@drawable/ic_arrow_back" 
       app:layout_collapseParallaxMultiplier="0.7" 
       app:layout_collapseMode="pin"/> 

     </android.support.design.widget.CollapsingToolbarLayout> 


    </android.support.design.widget.AppBarLayout> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/grid" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     /> 

</android.support.design.widget.CoordinatorLayout> 

당신은 여기에 대한 자세한 내용을 배울 수 : https://antonioleiva.com/collapsing-toolbar-layout/