我想做一个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