草庐IT

coordinatorLayout

全部标签

android:如何使用 CoordinatorLayout 和半透明导航栏?

我一直在研究新的谷歌支持设计库。我正在努力如何使导航栏半透明并在栏下方显示recyclerView的内容。我正在5.1nexus5上进行测试。我使用以下项目作为测试项目。ChrisBanes的示例代码:https://github.com/chrisbanes/cheesesquare我在下面添加到styles.xmltrue使导航栏半透明。但是,我无法使CoordinatorLayout及其内容recyclerView显示在栏下方。我想要的:recyclerView显示在导航栏下有快速返回功能,当应用栏隐藏时,它不应位于半透明状态栏下方。状态栏应该能够完全隐藏向上滚动的部分。

android - CoordinatorLayout 重叠

看看下面的布局。您会看到,float按钮距离底部太远。这是因为显示了Toolbar和Tabs,并且ViewPager的高度不正确。所以不知何故我在layout_height上做错了什么。但是我该如何解决呢?备注:ViewPager是主要内容,它在第二个选项卡中包含一个带有ListView和GoogleMapV2的fragment。这是布局XML:这是第一个选项卡(列表)中fragment的布局:只是为了确定;FAB没有问题。看这张照片。这是一个类似的布局。一个CoordinatorLayout带有一个ToolBar和一个ViewPager,它可以浏览所有的细节条目(因此不需要标签)。同

android - LinearLayout 重叠支持 CoordinatorLayout

我是第一次使用CoordinatorLayout,我不太了解它是如何工作的。我的LinearLayout与我的工具栏重叠,就好像我在FrameLayout或RelativeLayout中一样,我不知道如何告诉它到下面(比如android:layout_below和RelativeLayout)这是我的代码:....VeryLargeForm...另一个疑惑:我看到的例子几乎都是用CoordinateLayout管理RecyclerView的。我的布局不是RecyclerView,只是一个很长的表格。这样做有意义吗? 最佳答案 尝试将

android - CoordinatorLayout 中的 ViewPager 涵盖 API >= 21 上的其他 View

我正在使用Google新设计支持库中的新CoordinatorLayout。我有以下布局:问题是ViewPager总是覆盖在API>=21上的FloatingActionMenu之上,是否有解决此问题的方法?我尝试使用view.bringToFront()来解决这个问题,但没有成功。我也移动了Views,仍然没有成功。我尝试过的事情:将FABMenu移动到AppBarLayout将FABMenu移入LinearLayout运气不好。有没有人遇到过类似的事情? 最佳答案 原来这是一个简单的海拔问题,我将海拔设置为android:ele

android - 如何创建与 CoordinatorLayout 内容重叠的 AppBarLayout

在某些Activity中使用CoordinatorLayout和AppBarLayout时,我需要将内容放在AppBarLayout下方,即工具栏使用一些透明的颜色并覆盖内容。默认情况下,CoordinatorLayout+AppBarLayout安排工具栏和滚动内容彼此相邻,没有任何重叠。Android开发者指南有关于此的文档here它看起来像这样(但这些标志似乎不适用于Toolbar和appcompat-我试过了):所以我需要一些类似于上图的东西,但包含CoordinatorLayout+AppBarLayout提供的所有滚动功能。并且不需要使用CollapsingToolbarL

android - match_parent 不适用于 CoordinatorLayout

我使用Android设计支持库(com.android.support:appcompat-v7:22.2.0),并且我有一个LinearLayout在CoordinatorLayout像这样:在代码中我改变了背景颜色,我希望BG应该填满显示器(因为我在layout_width和layout_height中使用了match_parent)但是我得到了这样的BG颜色:看起来它显示了wrap_content不止使用match_parent.我尝试使用layout_weight在LinearLayout和layout_centerInParent中它也不起作用。我做错了什么?还是API错误?

android - CoordinatorLayout/NestedScrollView/隐藏显示工具栏/WebView 问题

我有一个问题:当我在webView中滚动时,工具栏被隐藏或显示(完美!)但是加载/定位网页存在问题。例如,如果我滚动到页面的中间并单击链接,将加载的新页面也位于页面的大约中间而不是顶部。就好像滚动条没有从一页移动到另一页。如果我添加到NestedScrollView:android:fillViewport="true"一切都适用于webview(页面加载并显示良好,尽管从顶部开始)但我失去了工具栏的隐藏/显示:(你对这个问题有什么想法吗?预先感谢您的帮助:)(有关信息:Android设计支持库:23.0.1)是的 最佳答案 我的假

android - BottomNavigationView 在 CoordinatorLayout 中重叠 FrameLayout

以下是我的布局xml。现在的问题是BottomNavigationView与FrameLayout重叠。我希望FrameLayout延伸到BottomNavigationView的顶部。我尝试了一些技巧,例如在FrameLayout中添加paddingBottom,但我想知道是否还有其他更好的解决方案。谢谢。更新:关于user_app_bar.xml的更多信息。它包含一个CollapsingToolbarLayout。 最佳答案 您的问题有简单的解决方案。即根据BottomNavigationViewheight将marginBot

android - RecyclerView inside CoordinatorLayout,AppBarLayout 滚动问题

我在fragment中有这个xml代码:android:id="@+id/profile_header_trophies"在项目集ClickListener的Java类中:@OnClick(R.id.profile_header_trophies)publicvoidprofile_header_trophies_clicked(){if(myProfile!=null){appBarLayout.setExpanded(false,false);if(myProfile.getBests().size()==0){profile_recyclerView.smoothScrollTo

android - 如何禁用 snackbar 的滑动关闭行为

有没有办法阻止用户通过滑动来关闭snackbar?我有一个在网络登录期间显示snackbar的应用程序,我想避免它被关闭。根据NikolaDespotoski的建议,我已经尝试了两种解决方案:privatevoidstartSnack(){loadingSnack=Snackbar.make(findViewById(R.id.email_login_form),getString(R.string.logging_in),Snackbar.LENGTH_INDEFINITE).setAction("CANCEL",newOnClickListener(){@Overridepubli