使用AS构建类安卓微信界面
本次实验分为2步:(一)设置UI界面;(二)编写java程序
(一)在xml中编程,使微信的UI界面能完美显示
1.首先去除安卓在左上角显示的软件标题,使用下面的代码
requestWindowFeature(Window.FEATURE_NO_TITLE);
去除后的效果图为
2.设计UI界面时需要设计头部,底部,以及4个按键对应的界面内容
我们将这4个界面用layout形式实现,名字分别取为top,bottom,tab01~04.
3.top的xml文件内容如下
<?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="50dp"
android:gravity="center"
android:background="#000000"
android:orientation="vertical">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/app_name"
android:textColor="#ffffff"
android:textSize="20sp" />
</LinearLayout>
4.bottom的xml文件内容中需要设置4个按钮的图标和中文
<?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:background="@drawable/bottom_ba