在我的应用程序,我展示与家庭按钮可见的工具栏。 在某些屏幕这可以作为一个向上按钮,在别人没有。
这工作正常。
问题是,导入设计支持库时,home键是不是在工具栏上显示。 这种情况只是通过导入它,而不是一个单一的代码行改变。
我与导入它在摇篮:
compile 'com.android.support:design:22.2.0'
我是否需要更改代码的东西的设计库不使家庭按钮消失? 这是设计库的另一个错误?
请注意,我还使用了支持LIB,如:
compile 'com.android.support:appcompat-v7:22.2.0'
此外,这是怎么吹大Toolbar
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- toolbar -->
<FrameLayout
android:id="@+id/toolbarContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<include layout="@layout/include_toolbar" />
</FrameLayout>
[....]
</RelativeLayout>
这是我设置的主页按钮的一个Fragment
。
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup
[....]
final Toolbar toolbar = (Toolbar)
view.findViewById(R.id.toolBar);
toolbar.setTitle(R.string.foo);
toolbar.setNavigationIcon(R.drawable.bar);
[....]
}
至于说,这些工作完全正常,直到我刚刚导入design
的摇篮库。
谢谢。