目录
一、项目内容
进行仿微信界面框架设计,包含微信、朋友、联系人、设置四个tab页面,点击相应图标进行切换,且选中图标变为绿色,未选中为灰色。
开发环境:Android Studio、Android SDK 11.0
二、代码实现
1、项目结构

2.头部代码
top.xml,使用LinearLayout布局
<?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"
android:background="@color/black"
>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="My WeChat"
android:textColor="@color/white"
android:textSize="30sp" />
</LinearLayout>

3.底部代码
bottom.xml,每个垂直的LinearLayout插入一个ImageView图像与一个TextView文本框
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/tab01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/tab01_img"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@drawable/weixin_pressed" />
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="微信" />
</LinearLayout>
<LinearLayout
android:id="@+id/tab02"
android:layout_width="wra

本文介绍了如何使用Android Studio和SDK 11.0来创建一个仿微信界面,包括微信、朋友、联系人、设置四个tab页面。详细讲解了项目结构、头部与底部布局代码、内容界面的实现以及在MainActivity中处理点击事件和图标颜色变化的方法。通过这个项目,作者初次接触Android开发并体验到其新颖之处,表达了对未来深入学习的兴趣。

被折叠的 条评论
为什么被折叠?



