繁体   English   中英

活动开始时折叠式工具栏布局将自动变为折叠状态

[英]Collapsing toolbar layout is going to collapsed state automatically on start of activity

我在应用栏布局中有一个折叠式工具栏。 它包含折叠内容的视图寻呼机和固定操作工具栏。 活动在折叠的工具栏下方还有一个嵌套的滚动视图。 嵌套的滚动视图包含一个Google地图片段。

在活动开始时,在某些情况下,折叠工具栏会自动折叠,而无需以编程方式折叠它。

我已经尝试使用scroll | exitUntilCollapsed | enterAlways为我的视图组合了不同的滚动标志。 我也尝试过不显示google map片段,但是我仍然可以复制它。

如何阻止它自动塌陷? 任何帮助,将不胜感激!

我知道已经晚了,但是仍然..

折叠式工具栏在活动启动时自动折叠的原因是,在< include layout =“ @ layout / content_scrolling” />中可能存在诸如edittext之类的视图,该视图在活动开始时会获得焦点。

要解决此问题,您可以添加标签

机器人:focusableInTouchMode = “真”

到或

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:focusable="true"
    android:focusableInTouchMode="true"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    xmlns:android="http://schemas.android.com/apk/res/android">

希望能帮助到你..:)

快乐编码.. :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM