Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

szhdev/ExpandMenu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

4 Commits

Repository files navigation

Android可展开收起的菜单栏

属性名称 含义 属性类型
back_color 菜单栏背景颜色 color
stroke_size 菜单栏边框粗细 dimension
stroke_color 菜单栏边框颜色 color
corner_radius 菜单栏边框圆角半径 dimension
button_style 按钮类型(居左或右) left | right
button_icon_size 按钮icon大小 dimension
button_icon_stroke_width 按钮icon粗细 dimension
button_icon_color 按钮icon颜色 color
expand_time 菜单栏展开收起动画时长(毫秒) integer
  • 效果展示:

  • 示例布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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">
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical">
 <TextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginLeft="15dp"
 android:layout_marginTop="15dp"
 android:text="默认菜单栏样式"/>
 <com.anlia.expandmenu.widget.HorizontalExpandMenu
 android:layout_width="match_parent"
 android:layout_height="40dp"
 android:layout_marginLeft="15dp"
 android:layout_marginRight="15dp">
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="horizontal"
 android:gravity="center_vertical"
 android:clickable="true">
 <TextView
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:gravity="center"
 android:text="item1"/>
 <TextView
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:gravity="center"
 android:text="item2"/>
 <TextView
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:gravity="center"
 android:text="item3"/>
 </LinearLayout>
 </com.anlia.expandmenu.widget.HorizontalExpandMenu>
 <TextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginLeft="15dp"
 android:layout_marginTop="20dp"
 android:text="按钮在左侧"/>
 <com.anlia.expandmenu.widget.HorizontalExpandMenu
 android:layout_width="match_parent"
 android:layout_height="40dp"
 android:layout_marginLeft="15dp"
 android:layout_marginRight="15dp"
 app:button_style="left">
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="horizontal"
 android:gravity="center_vertical"
 android:clickable="true">
 <TextView
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:gravity="center"
 android:text="item1"/>
 <TextView
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:gravity="center"
 android:text="item2"/>
 <TextView
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:gravity="center"
 android:text="item3"/>
 </LinearLayout>
 </com.anlia.expandmenu.widget.HorizontalExpandMenu>
 <TextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginLeft="15dp"
 android:layout_marginTop="20dp"
 android:text="可设置圆角、描边、阴影、按钮的颜色等等"/>
 <com.anlia.expandmenu.widget.HorizontalExpandMenu
 android:layout_width="match_parent"
 android:layout_height="40dp"
 android:layout_marginLeft="15dp"
 android:layout_marginRight="15dp"
 android:elevation="2dp"
 app:corner_radius="10dp"
 app:button_icon_color="@color/red"
 app:stroke_color="@color/red">
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="horizontal"
 android:gravity="center_vertical"
 android:clickable="true">
 <TextView
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:gravity="center"
 android:text="item1"/>
 <TextView
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:gravity="center"
 android:text="item2"/>
 <TextView
 android:layout_width="0dp"
 android:layout_height="match_parent"
 android:layout_weight="1"
 android:gravity="center"
 android:text="item3"/>
 </LinearLayout>
 </com.anlia.expandmenu.widget.HorizontalExpandMenu>
 <TextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_marginLeft="15dp"
 android:layout_marginTop="20dp"
 android:text="可自定义菜单栏里的内容,但只能设置一个直接子元素"/>
 <com.anlia.expandmenu.widget.HorizontalExpandMenu
 android:layout_width="match_parent"
 android:layout_height="40dp"
 android:layout_marginLeft="15dp"
 android:layout_marginRight="15dp">
 <HorizontalScrollView
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:fillViewport="true"
 android:scrollbars="none">
 <LinearLayout
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 android:orientation="horizontal"
 android:gravity="center_vertical"
 android:clickable="true">
 <TextView
 android:layout_width="100dp"
 android:layout_height="match_parent"
 android:gravity="center"
 android:background="@color/blue"
 android:text="item1"/>
 <TextView
 android:layout_width="50dp"
 android:layout_height="match_parent"
 android:gravity="center"
 android:background="@color/yellow"
 android:text="item2"/>
 <TextView
 android:layout_width="100dp"
 android:layout_height="match_parent"
 android:gravity="center"
 android:background="@color/green"
 android:text="item3"/>
 <TextView
 android:layout_width="150dp"
 android:layout_height="match_parent"
 android:gravity="center"
 android:background="@color/red"
 android:text="item4"/>
 </LinearLayout>
 </HorizontalScrollView>
 </com.anlia.expandmenu.widget.HorizontalExpandMenu>
 </LinearLayout>
</RelativeLayout>

About

可展开收起的菜单栏

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%

AltStyle によって変換されたページ (->オリジナル) /