2017-08-26 29 views
0

こんにちは、アンドロイドの画面の下部に表示されるダイアログを作成しようとしています。検索で私はBottomSheetDialogを使用できることがわかった。今私は私のBottomSheetDialogのimageviewと折りたたみ可能なツールバーが欲しい。スクロールアップ時に画像が崩壊すると、DETAILS (名前、情報、携帯電話番号など)を簡単なテキストビューとして表示したい。
私の問題は次のとおりです。
1.詳細を表示するためにレイアウトNestedScrollViewを追加すると、テキストは最初はイメージに重なりますが、イメージが折りたたまれてもテキストはイメージと重複しなくなります。テキストの位置は固定されたままであり、スクロールアップするときに画像が崩壊すると動かず、スクロールの経験は非常に非常に貧弱です。
2.リニアレイアウトを追加してDETAILSを表示すると、テキストが折りたたみ可能なツールバーの画像に表示されます。ここで 折りたたみ可能なツールバーを使用したBottomSheetDialog

は、ダイアログのための私のレイアウトファイルです:
<?xml version="1.0" encoding="utf-8"?> 
    android.support.design.widget.CoordinatorLayout 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_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

<android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fitsSystemWindows="true" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/profile_activity_collapsing_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"> 

      <ImageView 
       android:id="@+id/panel_profile_picture" 
       android:layout_width="match_parent" 
       android:layout_height="400dp" 
       android:adjustViewBounds="true" 
       android:scaleType="centerCrop" 
       app:layout_collapseMode="parallax" 
       app:layout_collapseParallaxMultiplier="0.7" /> 

      <!--<android.support.v7.widget.Toolbar--> 
       <!--android:id="@+id/toolbar"--> 
       <!--android:layout_width="match_parent"--> 
       <!--android:layout_height="?attr/actionBarSize"--> 
       <!--app:layout_collapseMode="parallax"--> 
       <!--app:popupTheme="@style/AppTheme.PopupOverlay" />--> 
     </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 

    <!--<ADD A LAYOUT HERE TO SHOW TEXTVIEW FOR DETAILS LIKE NAME,INFORMATION ETC>--> 

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


bottomSheetDialog activity.HereにタッチしたカードがbottomSheetDialogを示して自分のコードの場合に表示されます。

  convertView = mlayoutInflator.inflate(R.layout.panel_details_list_item, null); 
      /* setting texts in convertView */ 
      convertView.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View view) { 
       Log.d("Card touched","Card touched at " + position); 
       mBottomSheetDialog = new BottomSheetDialog(mContext); 
       bottomSheetView = mlayoutInflator.inflate(R.layout.panel_more_detail_item,null); 
       mBottomSheetDialog.setContentView(bottomSheetView); 
       mbottomSheetBehavior = BottomSheetBehavior.from((View) bottomSheetView.getParent()); 
       bottomSheetInterviewerImage = bottomSheetView.findViewById(R.id.panel_profile_picture); 
       bottomSheetInterviewerImage.setImageDrawable(drawableList.get(position)); 
       mBottomSheetDialog.show(); 
      } 
     }); 

折りたたみ可能なツールバーで妥協することなく詳細を表示するにはどうすればよいですか?私は、私のイメージが崩壊して上に上がると、texviewsが表示され、スクロールアップすると上に移動したい。

PS:明確でないコードや関連コードを掲載する必要がある場合は、ご意見ください。 TIA

答えて

0

は、私はあなたがあなたのイメージに触れるとをスクロールアップときに、イメージが崩れ、および詳細は、スクロール上にも上がる私のpurpose.Iがapp:layout_behavior="@string/appbar_scrolling_view_behavior"
としてアプリの挙動とFrameLayoutを使用しています提供何かを発見しました。ただし、詳細レイアウトに触れてスクロールアップすると、イメージを折りたたむことはできません。 1つは、画像に触れ、スクロールアップしなければならない。より良い解決策が見つかるまで、これは私の目的に役立ちます。
だからボトムシートダイアログのための私のレイアウトファイルは次のようである:

<?xml version="1.0" encoding="utf-8"?> 
    <android.support.design.widget.CoordinatorLayout 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_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="android.support.design.widget.BottomSheetBehavior"> 


    <android.support.design.widget.AppBarLayout 
     android:id="@+id/app_bar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:fitsSystemWindows="true" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/profile_activity_collapsing_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:fitsSystemWindows="true" 
      app:contentScrim="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"> 

      <ImageView 
       android:id="@+id/panel_profile_picture" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:adjustViewBounds="true" 
       android:scaleType="centerCrop" 
       app:layout_collapseMode="parallax" 
       app:layout_collapseParallaxMultiplier="0.7" /> 

      <!--<android.support.v7.widget.Toolbar--> 
       <!--android:id="@+id/toolbar"--> 
       <!--android:layout_width="match_parent"--> 
       <!--android:layout_height="?attr/actionBarSize"--> 
       <!--app:layout_collapseMode="parallax"--> 
       <!--app:popupTheme="@style/AppTheme.PopupOverlay" />--> 
     </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 
    <FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="300dp" 
      android:orientation="vertical"> 
      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="This is detial 1" 
       android:padding="20dp" 
       android:gravity="center"/> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="This is detial 2" 
       android:padding="20dp" 
       android:gravity="center"/> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="This is detial 3" 
       android:padding="20dp" 
       android:gravity="center"/> 

     </LinearLayout> 

    </FrameLayout> 

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

`

関連する問題