android:突发奇想仿"大叔帮帮忙"UI--one

本文详细介绍了如何模仿热门应用‘大叔帮帮忙’,通过使用Menudrawer开源包创建侧滑菜单,并定义了应用的主界面UI。文章强调了色彩设计的独特性,以及菜单布局的美观与实用性。同时,展示了应用启动时设置actionbar样式的过程,以及如何通过代码实现菜单的滑动和点击事件响应。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

大叔帮帮忙是最近比较火的一个android应用,闲着没事,决定高仿一下,可是忙活了半天,主要是大部分时间都在玩,中午写着写着看起了比赛(骑士VS湖人,23VS24),绝佳嘘头啊,还好今天我科今天比较牛逼,老詹也是牛逼,作为一个不讨厌老詹的科密,看着两人场上有说有笑,心里还是蛮开心的。

好了,闲话shaoxu,还是先看下大叔帮帮忙的主界面UI吧,首先定义色彩主调就是黄色,像QQ的蓝,陌陌的黑,这个还是比较罕见,不过还是挺漂亮的。



个人感觉,这个侧滑菜单还是比较帅气。

开始做吧,首先用了下第三方开源包menudrawer;

对于菜单界面xml布局代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#FFFFFFFF"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <LinearLayout
        android:id="@+id/ll_menu_info"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:layout_marginLeft="15dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="5dp"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="100dp"
            android:layout_gravity="center"
            android:layout_marginLeft="10dp"
            android:gravity="center"
            android:text="@string/user"
            android:textSize="18sp" />
    </LinearLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#eee" />

    <LinearLayout
        android:id="@+id/ll_menu_favor"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginStart="5dp"
            android:layout_marginTop="5dp"
            android:src="@drawable/button_favor" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp"
            android:gravity="center_vertical"
            android:text="@string/favor"
            android:textSize="16sp" />
    </LinearLayout>
    <LinearLayout
        android:id="@+id/ll_menu_lantern"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginStart="5dp"
            android:layout_marginTop="5dp"
            android:src="@drawable/button_lantern" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp"
            android:gravity="center_vertical"
            android:text="@string/lantern"
            android:textSize="16sp" />
    </LinearLayout>
    <LinearLayout
        android:id="@+id/ll_menu_msg"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginStart="5dp"
            android:layout_marginTop="5dp"
            android:src="@drawable/button_msg" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp"
            android:gravity="center_vertical"
            android:text="@string/msg"
            android:textSize="16sp" />
    </LinearLayout>
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_marginTop="5dp"
        android:background="#eee" />
   <LinearLayout
        android:id="@+id/ll_menu_visitor"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginStart="5dp"
            android:layout_marginTop="5dp"
            android:src="@drawable/button_visitor" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp"
            android:gravity="center_vertical"
            android:text="@string/visitor"
            android:textSize="16sp" />
    </LinearLayout>
    <LinearLayout
        android:id="@+id/ll_menu_friend"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_marginStart="5dp"
            android:layout_marginTop="5dp"
            android:src="@drawable/button_friend" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="5dp"
            android:gravity="center_vertical"
            android:text="@string/friend"
            android:textSize="16sp" />
    </LinearLayout>

</LinearLayout>


MainActivity先设置下actionbar样式

private void initBar() {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			ActionBar bar = getActionBar();
			Drawable drawable = getResources().getDrawable(
					R.drawable.actionbar_bg);
			bar.setBackgroundDrawable(drawable);
			bar.setDisplayUseLogoEnabled(false);
			bar.setDisplayHomeAsUpEnabled(false);
		}
	}


menudrawer = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY);
		menudrawer.setContentView(R.layout.activity_main);
		menudrawer.setMenuView(R.layout.activity_left);
		menudrawer.setSlideDrawable(R.drawable.btn_menu_toggle);
		menudrawer.setDrawerIndicatorEnabled(true);
		menudrawer.peekDrawer(500, 0);
设置滑动菜单菜单界面及内容界面,然后设置点击显示按钮切换菜单事件:

@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                menudrawer.toggleMenu();
                return true;
        }

        return super.onOptionsItemSelected(item);
    }

做到这些,滑动菜单已经完成了,明天开始实现菜单点击按钮,效果图如下:



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值