Mic*_*ael 5 android material-design
我想搜索我的应用工具栏.因此,用户具有带搜索操作图标的默认工具栏.单击它时,工具栏应调整大小,从上方放大或更大的替代幻灯片.它应该显示一些搜索字段和其他控件.退出搜索后,工具栏应调整为默认值或滑出.
当您按下蓝色浮动操作按钮时,谷歌地图会使用类似的东西(不完全一样,可能根本不是工具栏,但它看起来像):
这是最好的做法吗?这该怎么做?
制作自定义工具栏并在其中添加按钮、图像、文本视图,然后将其添加到您的活动中
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
android:layout_height="150dp"
android:layout_width="match_parent"
android:background="@color/ColorPrimary"
android:elevation="0dp"
android:theme="@style/Base.ThemeOverlay.AppCompat.Dark"
xmlns:android="http://schemas.android.com/apk/res/android" >
</android.support.v7.widget.Toolbar>
Run Code Online (Sandbox Code Playgroud)
在你的活动中
Toolbar mToolbar = (Toolbar) findViewById(R.id.tool_bar);
this.setSupportActionBar(mToolbar);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1909 次 |
| 最近记录: |