我是一名安卓中级开发人员,我需要有经验的人在我的内容活动中耍花招;
这是我的内容活动:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
....
// How this TextView never go out of the screen if the user scroll Down
<TextView ... />
....
</ScrollView>
*我做了什么:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView ... android:visibility="gone" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
....
//
<TextView ...android:visibility="visible"/>
....
</ScrollView>
</FrameLayout>
我考虑过有两个TextView,一个在顶部不可见,另一个可见。当用户向下滚动时,在第二个文本视图消失之前,我将第一个文本视图设置为可见。
这是个好办法吗?如果是,该怎么办?
尝试将TextView放置在scrollView之外。即
<LinearLayout>
<EditText />
<LinearLayout>
<ScrollView></ScrollView>
</LinearLayout>
</Linearlayout>
尝试一下,对不起格式
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:text="VISIBLE EVERY TIME"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="50dp"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/textView" >
</ScrollView>
</RelativeLayout>