仿微信公众号界面实现

最近在做一个关于微信公众平台服务号的小项目,主要用来实现排队叫号功能。一直都对微信公众号开发比较好奇,于是趁这次机会仔细研究了一下公众号的开发流程和逻辑架构。

微信公众平台现在分为3类:订阅号,服务号和企业号。其中,服务号和企业号的开放权限比较高,可以实现自定义菜单功能,调用摄像头以及LBS等API。

基本通信架构如图:


在项目的功能设计阶段本想搭建一个服务号Demo用来展示,但微信服务号的认证手续太麻烦,而且我也没有那个资质去开通服务号。于是打算自己做一个仿微信公众号的基本界面,先实现菜单功能,避免开发初期的公众号注册,同时也方便展示。

先上效果图:

  


1. 界面布局

主界面布局四部分,由上到下依次是:标题栏,消息列表,底部菜弹出的子菜单,底部菜单或输入栏。

主界面基本框架main.xml代码如下:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#E4E4E4" >

    <!-- 消息列表 -->

    <ListView
        android:id="@+id/lv"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginBottom="50dp"
        android:layout_marginTop="10dp"
        android:cacheColorHint="#00000000"
        android:divider="#00000000"
        android:dividerHeight="20dp"
        android:scrollbars="none" >
    </ListView>

    <!-- 点击底部菜单后弹出的子菜单 -->

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_marginBottom="50dp"
        android:orientation="horizontal" >

        <View
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.5" />

        <LinearLayout
            android:id="@+id/pop_layout1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_weight="1"
            android:orientation="vertical" >
        </LinearLayout>

        <LinearLayout
            android:id="@+id/pop_layout2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_weight="1"
            android:orientation="vertical" >
        </LinearLayout>

        <LinearLayout
            android:id="@+id/pop_layout3"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_weight="1"
            android:orientation="vertical" >
        </LinearLayout>
    </LinearLayout>
    
    <!-- 底部菜单 -->

    <LinearLayout
        android:id="@+id/bottom_layout"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_gravity="bottom"
        android:background="#00ffffff"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/bottom_menu_layout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="#ffffff"
            android:orientation="vertical" >

            <View
                android:layout_width="fill_parent"
                android:layout_height="1px"
                android:background="#A6A6A6" />

            <LinearLayout
                android:id="@+id/menu_layout"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:gravity="center"
                android:orientation="horizontal" >

                <ImageView
                    android:id="@+id/keyboard"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="5dp"
                    android:layout_marginLeft="3dp"
                    android:layout_marginRight="3dp"
                    android:layout_marginTop="5dp"
                    android:layout_weight="0.5"
                    android:background="@drawable/keyboard" />

                <View
                    android:layout_width="1px"
                    android:layout_height="fill_parent"
                    android:background="#A6A6A6" />

                <RelativeLayout
                    android:id="@+id/btn1"
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:background="@drawable/btn_selector" >

                    <RelativeLayout
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_margin="5dp" >

                        <TextView
                            android:id="@+id/text1"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent"
                            android:layout_centerInParent="true"
                            android:gravi
  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
Layui 是一个开源的前端框架,适用于快速构建Web界面。它为开发者提供了丰富的前端组件和简洁的代码风格,让开发者能够快速搭建出美观、高效的网页应用。Layui 框架主要基于HTML、CSS和JavaScript,支持多种常见的浏览器,并且可以与各种主流开发框架无缝集成。 微信公众号一个非常流行的社交平台,它提供了许多功能服务,包括消息推送、自定义菜单、关注用户、网页授权登录等等。通过微信公众号,用户可以与企业、个人等进行互动交流。 那么,Layui 和微信公众号之间的联系是什么呢?实际上,Layui 框架提供了一些与微信公众号开发相关的功能扩展和工具库。通过这些扩展和工具库,开发者可以更方便地在微信公众号中使用 Layui 框架进行界面开发。 例如,Layui 编辑器的扩展模块可以在微信公众号实现富文本编辑功能,让用户在发布文章或回复评论时更加便捷。另外,Layui 的上传组件扩展也可以在微信公众号实现图片上传、文件上传等功能,方便用户与公众号进行互动。 总之,Layui 可以为微信公众号开发提供更加丰富的前端解决方案,使开发者能够更高效地开发和维护公众号界面。无论是个人还是企业,通过使用 Layui 微信公众号扩展,可以为用户提供更好的使用体验,提升公众号功能性和吸引力。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值