2017-02-06 7 views
0

私は、Recyclerビューでデータを表示し、事前フィルタリングオプションを設定するアプリケーションを作成する必要があります。検索する主なオプションは左側に表示され、アイテムが選択されている場合は、チェックボックスで範囲を指定するオプションのセットがそれに応じて表示されます。レイアウトを使ってこのビューを設定することはできません。ここアンドロイドでの高度なフィルタリング

これは私がやったことで、私は事前にこの感謝を行うために私を助けてください
enter image description here

期待出力され

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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:id="@+id/activity_search" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.example.jijoabraham.informe.search" 
android:background="#ffffff"> 
<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    android:background="#FF00BCD4" 

    > 
    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar_filter" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="#1d2643" 
     app:layout_scrollFlags="scroll|enterAlways" 

     app:popupTheme="@style/ThemeOverlay.AppCompat.Light"> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Sales Report" 
      android:layout_gravity="center" 
      android:textSize="20sp" 
      android:textColor="@android:color/background_light" /> 



    </android.support.v7.widget.Toolbar> 

</android.support.design.widget.AppBarLayout> 
<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/layright" 
    android:layout_alignParentRight="true" 
    android:layout_toRightOf="@+id/layleft" 
    android:layout_above="@+id/laybottom" 
    android:background="#ffffff"></LinearLayout> 

<LinearLayout 
    android:orientation="vertical" 
    android:layout_height="match_parent" 
    android:id="@+id/layleft" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:layout_width="100dp" 
    android:gravity="center" 
    android:layout_above="@+id/laybottom" 
    android:background="#ffffff" 
    android:padding="5dp"> 

    <Button 
     android:text="Date" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/dte_btn" 
     android:background="@color/colorPrimaryDark" 
     android:textColor="#ffffff" 
     android:onClick="onSelect" 
     android:layout_marginBottom="5dp" /> 

    <Button 
     android:text="Branch" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/branch_btn" 
     android:background="@color/colorPrimaryDark" 
     android:textColor="#ffffff" 
     android:onClick="onSelect" 
     android:padding="5dp" 
     android:layout_marginTop="5dp" 
     android:layout_marginBottom="5dp" /> 

    <Button 
     android:text="Reports" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/reports_btn" 
     android:background="@color/colorPrimaryDark" 
     android:textColor="#ffffff" 
     android:onClick="onSelect" 
     android:padding="5dp" 
     android:layout_marginTop="5dp" /> 
</LinearLayout> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:foregroundGravity="bottom" 
    android:id="@+id/laybottom" 
    android:layout_alignParentBottom="true"> 

    <Button 
     android:text="Clear" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/btn_clear" 
     android:background="@color/colorPrimaryDark" 
     android:textColor="#ffffff" 
     android:padding="5dp" /> 

    <Button 
     android:text="Apply Filter" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/btn_filter" 
     android:layout_gravity="right" 
     android:gravity="center" 
     android:foregroundGravity="right" 
     android:background="@color/colorPrimaryDark" 
     android:textColor="#ffffff" 
     android:padding="5dp" 
     android:layout_marginLeft="10dp" /> 
</LinearLayout> 

答えて

0

あなたは作成することができますフラグメントの助けを借りてこのタイプのレイアウトを簡単に作成できます。 4つの異なるフラグメントを作成します。

  • FilterMenuFragmentは、一番左の画面です。
  • 日付が選択されている場合は、右側の画面のDateFilterFragment。
  • アドミッションが選択されている場合、右側の画面のアドミッションフィルタフラグメント。
  • ランクが選択されている場合、右側の画面のRankFilterFragment。

アクティビティクラスでは、それに応じてフラグメントの可視性を処理できます。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@android:color/transparent" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:id="@+id/bottomLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:weightSum="1"> 

     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.5" 
      android:text="Clear" /> 

     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.5" 
      android:text="Apply Filter" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@id/bottomLayout" 
     android:background="@android:color/holo_red_dark" 
     android:orientation="horizontal" 
     android:weightSum="1"> 

     <RelativeLayout 
      android:id="@+id/leftLayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@android:color/holo_blue_bright" 
      android:gravity="left" 
      android:layout_weight="0.60"/> 

     <RelativeLayout 
      android:id="@+id/rightLayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_weight="0.40" 
      android:gravity="right" 
      android:background="@android:color/holo_green_dark" /> 
    </LinearLayout> 
</RelativeLayout> 

をそして2つの方法が(データ)とクリア(データ)を適用し、すべての右側の断片でこれらのメソッドを実装してインターフェースを作成し、クリアのクリックを処理し、ボタンを適用するには:

レイアウトの下に試してみてください。

+0

同じアクティビティのフラグメントを使用して同じものを配置しますが、アクティビティの2つのボタンが必要ですレイアウトを配置できません –

+0

編集された答えを参考にしてください。 – nnn

+0

ありがとう仲間がありがたくありがとう、同じデザインを自分のやり方でやってみてください。デザイン標準の問題があれば、私の編集した質問を事前にお聞かせください –

関連する問題