这期内容当中小编将会给大家带来有关Android应用中怎么自定义一个菜单栏,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
创新互联主要从事网页设计、PC网站建设(电脑版网站建设)、wap网站建设(手机版网站建设)、响应式网站设计、程序开发、网站优化、微网站、微信小程序等,凭借多年来在互联网的打拼,我们在互联网网站建设行业积累了丰富的做网站、成都网站建设、网站设计、网络营销经验,集策划、开发、设计、营销、管理等多方位专业化运作于一体。在android开发的过程中系统自带的菜单往往满足不了开发中的一些需求,比如说一排最多只能放置三个菜单,坐多只能放置6个,再多的话就会折叠起来,如果我们想再一排显示4个或5个菜单那么就要自己想办法处理。
这里我用布局的隐藏并加上动画来模拟菜单的效果。
要点:
1、隐藏和显示菜单,我使用了一个线性布局把菜单封装起来。
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_alignParentBottom="true" android:background="@drawable/menubackground" android:layout_width="fill_parent" android:layout_height="144px" android:orientation="vertical" android:gravity="center" android:visibility="gone" android:id="@+id/lines"> <LinearLayout android:orientation="horizontal" android:gravity="center" android:layout_width="fill_parent" android:layout_height="72px" > <ImageButton android:layout_marginLeft="8dip" android:id="@+id/menu_btn_index" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_index_selector" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_news_selector" android:id="@+id/menu_btn_news" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_lib_selector" android:id="@+id/menu_btn_lib" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_add_selector" android:id="@+id/menu_btn_add" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_set_selector" android:id="@+id/menu_btn_set" /> </LinearLayout> <LinearLayout android:orientation="horizontal" android:gravity="center" android:layout_width="fill_parent" android:layout_height="72px"> <ImageButton android:layout_marginLeft="8dip" android:id="@+id/menu_btn_index" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_index_selector" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_news_selector" android:id="@+id/menu_btn_news" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_lib_selector" android:id="@+id/menu_btn_lib" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_add_selector" android:id="@+id/menu_btn_add" /> <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/menu_quit_selector" android:id="@+id/menu_btn_quit" /> </LinearLayout> </LinearLayout>
分享题目:Android应用中怎么自定义一个菜单栏-创新互联
当前路径:https://www.cdcxhl.com/article26/djpicg.html
成都网站建设公司_创新互联,为您提供网站维护、网站策划、用户体验、品牌网站设计、搜索引擎优化、手机网站建设
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联