2017-04-05 6 views
0

私はcontent_mainでナビゲーション・ドロワー・アクティビティを使用していますが、フラグメントで膨らんだ1つの線形レイアウトがあります。他のビューのスクロールでフラグメントのビューを隠す

content_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    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:id="@+id/content_home" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="net.techdesire.khabargujarat.HomeActivity" 
    tools:showIn="@layout/app_bar_home"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/fragment_container"/> 

</RelativeLayout> 

fragment_home.xml

<android.support.percent.PercentRelativeLayout 
    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" 
    tools:context="fragment.HomeFragment"> 

     <android.support.v4.view.ViewPager 
      android:id="@+id/viewpager" 
      android:layout_width="match_parent" 
      app:layout_heightPercent="40%"/> 


     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:padding="5dp" 
      app:layout_heightPercent="60%" 
      android:layout_below="@+id/viewpager"> 

      <TextView 
       android:id="@+id/about" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="5dp" 
       android:text="@string/about_khijadiya" 
       android:textAppearance="@style/TextAppearance.AppCompat.Large"/> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/about" 
       android:text="@string/dummy" 
       android:textAppearance="@style/TextAppearance.AppCompat.Medium"/> 
     </RelativeLayout> 
</android.support.percent.PercentRelativeLayout> 

私は約という名前のTextViewに大きなコンテンツを持っています。 image.Firstのようにスクロール可能にしたいのですが、最初に全画面にスクロールしてください。また、aboutの内容がまだオーバーフローしている場合は、テキストビューをスクロール可能にしてください。スクロールが一番上に移動し、そこから下にスワイプすると、ビューページャが再び表示されます。

enter image description here

+0

を。あなたは別の方法を説明しようとすることができますか? –

答えて

0

私はスクロールしながら、あなたの要件は、ビューを崩壊さ、と思います。

"android.support.design.widget.CollapsingToolbarLayout"を使用できます。

材料設計で実装されています。

あなたは、このリンクを参照することができます:私はあなたが望むものを理解していなかった http://www.androidhive.info/2016/05/android-working-with-card-view-and-recycler-view/

+0

はい、そのようなものですが、正確ではありません。私はツールバーや他のものを操作したくなかった。私は1つのxmlファイルの変更だけでそれを作ることができますか? –

+0

はい、ただし、あなたの視点によって異なります。 –

関連する問題