现在Android设计支持库已经推出,有没有人知道如何用它实现扩展的Fab菜单,比如Inbox App上的fab?
应该是这样的:
目前我正在片段中的停止方法上使用mRequestQueue.cancelAll(getActivity()),但显然当我将手机从横向移动到肖像时,它仍然返回请求中的数据但导致崩溃,因为持有者为数据剂量已经存在.任何正确的代码示例代码?
我试图通过这样做以编程方式更改工具栏背景颜色:
getSupportActionBar().setBackgroundDrawable(newColorDrawable(getResources().getColor(R.color.test_color_blue)));
Run Code Online (Sandbox Code Playgroud)
这就是结果:
之前:
后:
工具栏标题仍然具有与以前相同的背景颜色.
这是我的工具栏xml:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/Theme.Toolbar">
Run Code Online (Sandbox Code Playgroud)
这是主题:
<style name="Theme.Toolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:maxHeight">@dimen/abc_action_bar_default_height_material</item>
<item name="android:background">@color/primary</item>
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@android:color/white</item>
<item name="titleTextAppearance">@style/Theme.Toolbar.Title</item>
</style>
Run Code Online (Sandbox Code Playgroud)