首页 \ 问答 \ CollapsingToolbarLayout和FloatingActionButton(CollapsingToolbarLayout and FloatingActionButton)

CollapsingToolbarLayout和FloatingActionButton(CollapsingToolbarLayout and FloatingActionButton)

我有CollapsingToolbarLayout和两个FloatingActionButtons 。 只有在Toolbar展开时,这些FAB才可见。 何时折叠,它们是隐藏的。 我需要它们可见,如果工具栏也崩溃了。 我该怎么做?

非常感谢提示...

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".CalendarEventInsUpdActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="parallax"
                app:popupTheme="@style/AppTheme.PopupOverlay"/>

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_calendar_event"/>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/btnSave"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_menu_save"
        app:backgroundTint="@android:color/holo_green_light"
        app:layout_anchor="@id/app_bar"
        app:layout_anchorGravity="bottom|center"/>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/btnCancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_menu_revert"
        app:backgroundTint="@android:color/holo_red_light"
        app:layout_anchor="@id/app_bar"
        app:layout_anchorGravity="bottom|end"/>

</android.support.design.widget.CoordinatorLayout>

I have CollapsingToolbarLayout and inside two FloatingActionButtons. These FABs are visible only when the Toolbar is expanded. When is collapsed, they are hidden. I need them visible, if toolbar is collapsed too. How can I do it?

Thanks a lot for tips...

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".CalendarEventInsUpdActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="parallax"
                app:popupTheme="@style/AppTheme.PopupOverlay"/>

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_calendar_event"/>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/btnSave"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_menu_save"
        app:backgroundTint="@android:color/holo_green_light"
        app:layout_anchor="@id/app_bar"
        app:layout_anchorGravity="bottom|center"/>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/btnCancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_menu_revert"
        app:backgroundTint="@android:color/holo_red_light"
        app:layout_anchor="@id/app_bar"
        app:layout_anchorGravity="bottom|end"/>

</android.support.design.widget.CoordinatorLayout>

原文:https://stackoverflow.com/questions/36327801
更新时间:2023-12-10 22:12

最满意答案

在您的.emacs位置(setq-default fill-column 80)或者您可以在填充列上使用Mx自定义变量,然后使用标准自定义界面为您设置并保存它。


In your .emacs place (setq-default fill-column 80) Or you can just use M-x customize-variable on fill-column, and it will set it and save it for you using the standard customize interface.

相关问答

更多
  • 如何这样的事情: (add-hook 'markdown-mode-hook (lambda () (variable-pitch-mode t)) 然后,您可以自定义variable-pitch面,并且缓冲区中的其他面将从此继承,而不是默认面。 阅读buffer-face-mode的文档以获取更多定制细节。 (BufFace也用于text-scale-increase和text-scale-decrease ...非常有用。) How about something like this: (add-ho ...
  • 在您的.emacs位置(setq-default fill-column 80)或者您可以在填充列上使用Mx自定义变量,然后使用标准自定义界面为您设置并保存它。 In your .emacs place (setq-default fill-column 80) Or you can just use M-x customize-variable on fill-column, and it will set it and save it for you using the standard customi ...
  • (customize-variable (quote tab-stop-list)) 或者将.emacs文件中的tab-stop-list条目添加到custom-set-variables中: (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file sho ...
  • 你只需要在那些模式中设置fill-column ,你可以通过定义一个函数来完成这个操作并将钩子添加到相关的模式中(你也可以将它作为一个lambda ,但通常把它放在一个好的做法中)一个命名函数,所以如果你需要,你可以稍后从钩子中删除它。 *.h文件默认以c-mode ,而*.cpp文件默认以c++-mode 。 首先,定义一个函数: (defun my-c-hook () (setq fill-column 80)) 然后,将该函数添加到相关模式挂钩: (add-hook 'c-mode-hook ' ...
  • 看来你需要的是CEDET /语义。 它已经内置了新的Emacs版本。 它进行代码分析,因此它将向您显示结构的有效成员。 启用语义(semantic-mode 1) 调用semantic-analyze-possible-completions来显示完成 我使用emacs -q为Emacs 24.3.1测试了它 - 它的工作原理。 还有semantic-ia-complete-symbol和许多你可能感兴趣的其他函数。 虽然auto-complete-mode确实具有ac-source-semantic ,并 ...
  • 有一个代码在emacs交换中解决了比wincow的wicth更少的缓冲区。 看看@JeanPierre的答案。 它使用set-window-margins参见这里的emacs手册。 这是一个交互功能,所以使用Mx my/change-window-width在从头开始评估后调用它。 (defun my/change-window-width (width) "Adjust margins so that window is centered" (interactive "NWindow width: " ...
  • 在钩子中你应该使用setq而不是setq-default ,所以你需要将钩子重写为: (defun my-verilog-hook () (setq indent-tabs-mode nil) (setq tab-width 3)) (add-hook 'verilog-mode-hook 'my-verilog-hook) PS最好在钩子中使用专用函数,因为它更容易更改它们,你也可以从钩子中删除它们 In the hook you should use setq instead of ...
  • 通过“非常不同的格式化”来理解你的意思是非常有帮助的。 袒露...... 从理论上讲,您应该能够使用Mx customize-apropos org-agenda和/或在emacs配置中设置正确的org-agenda变量来实现您所寻求的目标。 您甚至可以考虑将一些函数/操作绑定在一个可用于创建/修改议程缓冲区的自定义函数中,或者您可以修改org-agenda-hook以自动执行所需的操作。 它听起来像你能够修改缓冲区以你想要的方式出现,此时的诀窍,如果我理解你正确的是弄清楚如何自动化这个过程。 另外,请考虑 ...
  • 首先,你必须设置它(我只是确保你有这个部分正确): (defun my-change-log-mode-hook () (setq fill-column 120)) (add-hook 'change-log-mode-hook 'my-change-log-mode-hook) 其次,您必须确保没有覆盖此目录的本地变量设置。 例如,在编辑Emacs本身的源代码时,fill-column将设置为74以进行更改日志模式 ,将70设置为其他位置,覆盖您在μourhook中指定的值。 它们在名为.dir ...
  • 从Ch v default-tab-width RET 自23.2以来,这个变量已经过时了; 使用`tab-width'代替。 和tab-width 文档: *制表位之间的距离(用于显示制表符),以列为单位。 您可以自定义此变量。 当我插入 (custom-set-variables '(tab-width 4)) 进入~/.emacs并重新启动emacs,它被设置为4 。 From C-h v default-tab-width RET This variable is obsolete since ...

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)