新建一个安卓空项目,语言采用Java,基于Android SDK11.0实现,使用虚拟设备Pixel 5 API 30.
实现顶部微信栏-layout_top.xml.
创建时选择LinearLayout,新建一个TextView表示一个文本框,设置gravity为center,即实现居中,文本输入微信,大小设置为24sp.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:gravity="center"
android:text="微信"
android:textSize="24sp" />
</LinearLayout>

实现底部微信栏-layout_bottom.xml.
导入图片资源于resource目录下,用于实现微信底部菜单栏图片以及点击后图片变换效果。

创建时选择LinearLayout,同时新建四个LinearLayout于父LinearLayout,四个LinearLayout各含一个TextView和一个imageButton,用于实现微信底部菜单栏。

调整图片大小,设置背景,设置垂直布局,TextView文本居中,如果图片大小适合,较为适用的选择wrap_content,系统自动弹性布局高度,每个子LinearLayout的weight权重为1,此底部菜单栏需要不断调整以达到想要的效果,下面是其中一个LinearLayout的配置。
<LinearLayout
and