移动开发:微信门户界面设计(Android Studio)

1.APP主界面

实现类似微信主界面,如下图
在这里插入图片描述

2.布局(layouts)

1.activity_main.xml

将界面分成三部分

  顶部、 中间、  底部

在这里插入图片描述在这里插入图片描述

包含top、content、bottom
核心代码片:

<include
        layout="@layout/top"
        android:layout_width="match_parent"
        android:layout_height="77dp" />

    <FrameLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="424dp" />

    <include
        layout="@layout/bottom"
        android:layout_width="match_parent"
        android:layout_height="225dp" />
  1. top.xml
    在这里插入图片描述

核心代码片

<TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="52dp"
        android:gravity="center"
        android:text="微信" />

  1. bottom.xml
    在这里插入图片描述
    在这里插入图片描述
    核心代码片

    <LinearLayout
        android:id="@+id/Linearlayout_weixin"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/imageViewweixin"
            android:layout_width="match_parent"
            android:layout_height="110dp"
            app:srcCompat="@drawable/weixin" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:gravity="center"
            android:text="微信" />
    </LinearLayout>
    

3. 分段(fragment)

建立4个fragmnt
在xml输入每个界面的文本
在这里插入图片描述

4.MainActivity的import

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;

5.Fragment、LinearLayout、Imageview的定义

    private Fragment weixinFragment =new weixinFragment();
    private Fragment friendFragment =new friendFragment();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值