移动开发第一次作业——Android Studio微信页面搭建

本文介绍了如何使用Android Studio搭建微信页面,包括顶部标题、中间显示框和底部选择框的布局设计,以及Fragment和LinearLayout的使用。通过创建不同的XML布局文件和对应的Fragment,实现了底部选项切换时中间内容同步更新的功能。最后展示了微信、朋友、通讯录和设置四个界面的运行效果,并提供了源码链接。
摘要由CSDN通过智能技术生成

Android Studio搭建微信页面

项目总体要求:
1、页面具有标题
2、页面有中间显示框
3、页面具有底部选择框,并且具有选择事件
4、在页面底部选择框进行改变的时候,中间显示框的页面同步改变

布局设计:
1、一个顶部的LinearLayOut 显示顶部内容
2、底部的4个标签,使用4个LinearLayOut 并且是横向布局
3、四个Fragment 分别对应4个页面的内容,即微信、朋友、通讯录、设置

一、布局文件
1、需新建一个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="65dp"
    android:gravity="center"
    android:background="#000000"
    android:orientation="vertical">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_gravity="center_horizontal"
        android:layout_weight="1"
        android:text="@string/app_name"
        android:textColor="#ffffff"
        android:textSize="20sp" />
</LinearLayout>

意为在顶部中间添加一个文本MyWeChat,背景采用黑色

2、需新建一个bottom.xml文件来进行底部布局

    <LinearLayout
        android:id="@+id/id_tab_weixin"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center"
        android:orientation="vertical">

        <ImageButton
            android:id="@+id/id_tab_weixin_img"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#000000"
            android:clickable="false"
            android:contentDescription="@string/app_name"
            app:srcCompat="@drawable/tab_weixin_pressed" />

        <TextView
            android:id
  • 1
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值