请帮助我创建一个类似于此主页设计的工具栏:
工具栏的顶部有3个按钮(3个图像按钮),
下面的2个按钮,搜索框(图像按钮)和镜头(图像按钮)
我在顶部放置了3个按钮,但无法在正确的位置添加搜索框和镜头按钮
我正在使用导航抽屉活动.活动名称为“家”
<?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="com.example.cortana.shopv3.HomeActivity"> <androID.support.design.Widget.AppbarLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:theme="@style/Apptheme.AppbarOverlay"> <androID.support.v7.Widget.Toolbar androID:ID="@+ID/toolbar" androID:layout_wIDth="match_parent" androID:layout_height="?attr/actionbarSize" androID:background="?attr/colorPrimary" app:popuptheme="@style/Apptheme.PopupOverlay" androID:weightSum="1"> <Imagebutton androID:layout_wIDth="wrap_content" androID:layout_height="match_parent" app:srcCompat="@androID:drawable/ic_menu_sort_by_size" androID:layout_marginleft="100sp" androID:background="@null" androID:adjustVIEwBounds="true" androID:cropTopadding="true" /> <Imagebutton androID:layout_wIDth="wrap_content" androID:layout_height="match_parent" app:srcCompat="@androID:drawable/btn_plus" androID:layout_marginleft="15sp" androID:background="@null" androID:adjustVIEwBounds="true" androID:cropTopadding="true" /> <Imagebutton androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" app:srcCompat="@androID:drawable/ic_menu_save" androID:ID="@+ID/savebtn" androID:background="@drawable/refreshgreen" androID:adjustVIEwBounds="true" androID:layout_marginleft="15sp" androID:layout_alignParenttop="true" androID:layout_marginBottom="15sp" androID:cropTopadding="true" /> </androID.support.v7.Widget.Toolbar> </androID.support.design.Widget.AppbarLayout></androID.support.design.Widget.CoordinatorLayout>
解决方法:
试试这个让你的工具栏像这样
<androID.support.v7.Widget.Toolbar androID:ID="@+ID/toolbar" androID:layout_wIDth="match_parent" androID:layout_height="?attr/actionbarSize" androID:background="?attr/colorPrimary" app:popuptheme="@style/Apptheme.PopupOverlay"> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:orIEntation="vertical"> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:orIEntation="horizontal"> <Imagebutton androID:layout_wIDth="wrap_content" androID:layout_height="match_parent" androID:layout_marginleft="100sp" androID:adjustVIEwBounds="true" androID:background="@null" androID:cropTopadding="true" app:srcCompat="@androID:drawable/ic_menu_sort_by_size" /> <Imagebutton androID:layout_wIDth="wrap_content" androID:layout_height="match_parent" androID:layout_marginleft="15sp" androID:adjustVIEwBounds="true" androID:background="@null" androID:cropTopadding="true" app:srcCompat="@androID:drawable/btn_plus" /> <Imagebutton androID:ID="@+ID/savebtn" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParenttop="true" androID:layout_marginBottom="15sp" androID:layout_marginleft="15sp" androID:adjustVIEwBounds="true" androID:background="@drawable/ic_down" androID:cropTopadding="true" app:srcCompat="@androID:drawable/ic_menu_save" /> </linearLayout> <EditText androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" /> </linearLayout></androID.support.v7.Widget.Toolbar>
总结 以上是内存溢出为你收集整理的创建自定义工具栏?全部内容,希望文章能够帮你解决创建自定义工具栏?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)