gpt4 book ai didi

android - 如果用户向下滚动,TextView 如何永远不会离开屏幕?

转载 作者:行者123 更新时间:2023-11-29 02:03:08 25 4
gpt4 key购买 nike

我是一名 android 中级开发人员,我需要有人在我的内容 Activity 中做一些技巧;

这是我的内容 Activity :

<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>

我考虑过使用 2 个 TextView,一个在顶部不可见,另一个可见。当用户向下滚动时,在第二个 TextView 消失之前,我将第一个 textView 设置为可见。

这是个好方法吗?如果是这样怎么办?

最佳答案

尝试将 TextView 放在 scrollView 之外。 IE。

<LinearLayout> 
<EditText />
<LinearLayout>
<ScrollView></ScrollView>
</LinearLayout>
</Linearlayout>

试一试格式不好

关于android - 如果用户向下滚动,TextView 如何永远不会离开屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11508041/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com