2017-02-09 2 views
3

は怒鳴る:サイズ変更の方法エッジジェスチャーを引っ張って表示しますか?私は、画像上のように、溶液を探しています

enter image description here

私は1つのレイアウトで2つのサイズ変更可能なビューを持っている必要があります。 ユーザーは、分離線を上部(ScrolView Bが高くなる)または下部(ScrolView Aが高くなる)に移動する必要があります。

この現象を引き起こす最適な解決策は何ですか?私はScrollViewから拡張してpublic boolean onTouchEvent(MotionEvent ev)protected void onDraw(Canvas canvas)をオーバーライドできることを知っていますが、もっと簡単な解決策があるかもしれません。私は移動の数学の計算を避けたい。ご連絡ありがとうございます。

+1

あなたは基本的にAndroid Nの分割画面を望んでいますhttp://androidxref.com/7.1.1_r6/xref/frameworks/base/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.javaスタックと関連があるすべてを捨てることができるはずです。実際に活動している活動。 – JohanShogun

答えて

3

この問題をすばやく解決したい場合は、Split Pane Layoutを使用することをおすすめします。

用途:

<com.mobidevelop.spl.widget.SplitPaneLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:spl="http://schemas.android.com/apk/res-auto" 
     android:layout_width="match_parent" 
     android:id="@+id/splitPaneLayout" 
     android:layout_height="match_parent" 
     spl:splitterSize="12dp" 
     spl:orientation="vertical" 
     spl:splitterPosition="50%" 
     spl:splitterBackground="#781b23"> 

     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="5dp" 
       android:text="" /> 

     </ScrollView> 

     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <TextView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:padding="5dp" 
       android:text=""/> 

     </ScrollView> 

</com.mobidevelop.spl.widget.SplitPaneLayout> 

私は、肖像画や風景モード用の2つのXMLSを作成することによって、あなたの問題を解決しました。ポートレートモードでは、私はspl:orientation="vertical"を追加してパネルの向きを垂直に設定し、lanscapeモードではパネルの向きを水平に設定してspl:orientation="horizontal"を追加します。

これをすべて実行した後、私は以下のように見えます。 enter image description here enter image description here

1

これを回答にしました。

あなたは基本的にあなたがSystemUIでのオープンソース実装を離れてあなたのコードをベースにできアンドロイドN.から分割画面表示をしたい: http://androidxref.com/7.1.1_r6/xref/frameworks/base/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java

これに伴いハンドルのために: http://androidxref.com/7.1.1_r6/xref/frameworks/base/packages/SystemUI/src/com/android/systemui/stackdivider/DividerHandleView.java

あなたが投げることができます(履歴内のさまざまなアクティビティからのスクリーンショットの行です)、バスイベント、およびアプリケーション間のVsyncingのコード(mSurfaceFlingerOffsetMs)など、別のアクティビティの実行に関係するものをすべて削除してください。

非常に小さくて使いやすいクラスを残すはずです。

関連する問題