我想做一個newsfeed,它有一個底部的textview和頂部的imageview。當您在橫幅上滾動應用程序的描述時,文本應該像在谷歌播放一樣在圖像視圖上滾動。如何滾動imageview上的textview像谷歌播放
我已經找到2個主題在這裏問其究竟我的問題,但遺憾的是沒有一個正確的答案 Textview scroll on Imageview like Pulse app scroll
Textview Scrolling Behind the Imageview
感謝您的幫助。
我想做一個newsfeed,它有一個底部的textview和頂部的imageview。當您在橫幅上滾動應用程序的描述時,文本應該像在谷歌播放一樣在圖像視圖上滾動。如何滾動imageview上的textview像谷歌播放
我已經找到2個主題在這裏問其究竟我的問題,但遺憾的是沒有一個正確的答案 Textview scroll on Imageview like Pulse app scroll
Textview Scrolling Behind the Imageview
感謝您的幫助。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/ImageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding_top="200dp"
>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:text="@string/hello_world" />
</LinearLayout>
</ScrollView>
</FrameLayout>
將線性佈局的Padding_top設置爲imageView的高度(在java中執行此操作或設置一些像我所做的那樣的隨機數)。希望這會起作用。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/ImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="26dp">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
android:text="@string/blablabla" />
</ScrollView>
</LinearLayout>
謝謝,它的作品:) – David 2014-10-05 18:51:57
快樂,我可以幫助你。快樂的編碼。 – Harsha 2014-10-05 18:52:50
代表@ RTN073:上述解決方案對我而言並不像預期的那樣。請你提供相應的java類。 – 2015-05-17 11:07:45