2016-04-28 11 views
0

私はアプリケーションを作成しています。ユーザ情報は相対的なレイアウトで示されている。相対レイアウトの下には、ユーザーが作成したアイテムのリストビューがあります。リストビューでスクロールして、相対レイアウトがスクロールアップして最終的に消えてしまい、リストビューが画面全体に伸びていたらいいですか?リストビューを上にスクロールすると相対レイアウトがスクロールされます

あなたはfacebookアプリを持っているようです。 Facebook Scrolling image

私はこれをどのように行うのですか、これは私のレイアウトファイルです:事前に

<?xml version="1.0" encoding="utf-8"?> 
 
<merge xmlns:android="http://schemas.android.com/apk/res/android" 
 
    android:layout_width="match_parent" 
 
    android:layout_height="match_parent" 
 
    android:orientation="vertical"> 
 

 
    <LinearLayout 
 
     android:layout_width="match_parent" 
 
     android:layout_height="match_parent" 
 
     android:orientation="vertical"> 
 

 
     <RelativeLayout 
 
      android:layout_width="match_parent" 
 
      android:layout_height="0dp" 
 
      android:layout_weight="6"> 
 

 
      <ImageView 
 
       android:id="@+id/BackgroundPictureOther" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="150dp" 
 
       android:background="#eeeeee" /> 
 

 

 
      <ImageView 
 
       android:id="@+id/profileOther" 
 
       android:layout_width="100dp" 
 
       android:layout_height="100dp" 
 
       android:background="#444444" 
 
       android:scaleType="fitXY" 
 
       android:layout_gravity="center_horizontal" 
 
       android:layout_alignParentBottom="true" 
 
       android:layout_centerHorizontal="true" 
 
       android:layout_marginBottom="40dp"/> 
 

 
      <TextView 
 
       android:id="@+id/profileName" 
 
       android:layout_width="wrap_content" 
 
       android:minWidth="150dp" 
 
       android:layout_centerHorizontal="true" 
 
       android:textColor="#aaa" 
 
       android:textAlignment="center" 
 
       android:textSize="30sp" 
 
       android:layout_height="wrap_content" 
 
       android:layout_alignParentBottom="true" 
 
       android:textAppearance="?android:attr/textAppearanceLarge" /> 
 

 
     </RelativeLayout> 
 

 
     <ListView 
 
      android:layout_width="match_parent" 
 
      android:layout_height="0dp" 
 
      android:layout_weight="8"></ListView> 
 
    </LinearLayout> 
 

 
</merge>

ありがとう!

1)あなたはNestedScrollView内側にあなたの全体のレイアウトを入れて、RecyclerViewにリストビューを変更する必要があります。

答えて

0

あなたはここに2つのオプションがあります。

2)または、プロファイルビューでヘッダービューとしてレイアウトを設定することもできます。 これを行うには、他のXMLレイアウトファイルにプロファイルを配置してから、コードで膨らませてからlistview.addHeaderView(view v)を使用する必要があります。

+0

ありがとう、addHeaderを使用していただきありがとうございます。 –

関連する問題