gpt4 book ai didi

android:windowTranslucentStatus 在 Android 5.0/6.0 上中断了滚动

转载 作者:搜寻专家 更新时间:2023-11-01 08:31:39 25 4
gpt4 key购买 nike

安卓 6.0。我想要半透明的状态栏。

my_layout.xml:

<ScrollView
android:id="@+id/srollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:fitsSystemWindows="true">
<LinearLayout
android:id="@+id/content_layer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/containerPhoneNumber"
android:layout_width="match_parent"
android:layout_height="64dp">
<EditText
style="@style/edit_text_style"
android:layout_width="match_parent"
android:layout_height="64dp"
/>
...
</ScrollView>

样式.xml

<style name="RegistrationTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
</style>

因此状态栏是半透明的。好的。在 Android 7.0 启动 my_layout.xml 时,关注 editText scroll 成功滚动。好的。但是当我在 Android 5.0/6.0 上运行相同的 my_layout.xml 时,滚动不起作用。为什么?谢谢。

最佳答案

解决方案是为 ScrollView 创建父容器(具有属性 "fitsSystemWindows"= true 的 LinearLayout)。

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<ScrollView
android:id="@+id/srollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:fitsSystemWindows="true">
<LinearLayout
android:id="@+id/content_layer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/containerPhoneNumber"
android:layout_width="match_parent"
android:layout_height="64dp">
<EditText
style="@style/edit_text_style"
android:layout_width="match_parent"
android:layout_height="64dp"
/>
...
</ScrollView>
</LinearLayout>

谢谢。

关于android:windowTranslucentStatus 在 Android 5.0/6.0 上中断了滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40133778/

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