UI布局设计

UI设计

view

view和view的子类不在同一个包中

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-paKAjniR-1625837245386)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708133109848.png)]

view常用属性

  1. android:id = “@+id/ 具体的id”

  2. android:background="@mipmap/ 图片名称" ------图片需在mipmap文件夹下

    android:background="#FF6600" ------后面跟的是十六进制颜色

  3. android:padding

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-EOFE4fAK-1625837245388)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708133906516.png)]

android:padding=“16dp” android:padding

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JSv6feI3-1625837245391)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708134112894.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ATZVLRp1-1625837245395)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708134212615.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-2uwYUH3D-1625837245397)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708134256729.png)]

ViewGroup

ViewGroup.LayoutParams

控制view的位置,高度,宽度

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-detHQOJH-1625837245398)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708135428409.png)]

ViewGroup.MarginLayoutParams

控制外边距

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-eJlvtmSr-1625837245400)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708135619425.png)]

UI组件的层次结构

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-aQEdYvlJ-1625837245401)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708135832608.png)]

控制UI界面

控制UI界面的几种方法

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-9Of9zA6Q-1625837245403)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708140057017.png)]

使用XML布局文件空间UI界面

  1. 在Android应用的res/layout目录下编写XML布局文件

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-oxwTgj36-1625837245403)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708140304978.png)]

  2. 在Activity中使用以下Java代码显示XML文件中布局的内容

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-plnMosMV-1625837245405)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708140729547.png)]

实例

设置背景照片

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-48NEjGCc-1625837245405)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708141844305.png)]

设置文本的格式

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-LroYy8H6-1625837245406)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708142352735.png)]

另一种方法引用字符串

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-AxDGTsYW-1625837245407)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708142546315.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Z7WkGSi4-1625837245409)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708142628925.png)]

在Java代码中控制UI界面

所有的UI组件都可以通过new关键子生成,然后将UI组件添加到布局管理器当中实现用户界面

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lsoI8o7k-1625837245410)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708143352141.png)]

由于Android Studio中无法调用AppCompatActivity类,也有可能是我哪里出错了,所以把视频链接放在这这,方便日后查看

https://www.bilibili.com/video/BV1jW411375J?p=15

使用XML和Java代码混合控制UI界面

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Efvk2Zcc-1625837245411)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708150440440.png)]

设置XML布局文件

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-UEVXoJWG-1625837245412)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708153259240.png)]

设置Java代码

package com.example.uicontrol_java_xml;

import androidx.appcompat.app.AppCompatActivity;

import android.media.Image;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.GridLayout;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {
    private ImageView[] img = new ImageView[12];    //声明一个大小为12的图片数组
    private int[] imagePath = new int[]{            //
            R.mipmap.img1,R.mipmap.img2,R.mipmap.img3,R.mipmap.img4,
            R.mipmap.img5,R.mipmap.img6,R.mipmap.img7,R.mipmap.img8,
            R.mipmap.img9,R.mipmap.img10,R.mipmap.img11,R.mipmap.img12,
    };
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);     //调用XML布局文件
        GridLayout layout = (GridLayout) findViewById(R.id.layout); //通过id来查找GridLayout
        for(int i=0;i<imagePath.length;i++){
            img[i] = new ImageView(MainActivity.this);
            img[i].setImageResource(imagePath[i]);               //设置每个img的图片
            img[i].setPadding(2,2,2,2);   //内边距
            ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(116,68); //设置图片的大小
            img[i].setLayoutParams(params);    //将图片的参数传给img
            layout.addView(img[i]);            //将img添加到XML布局页面中
        }
    }
}

实现

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-dDvm58h2-1625837245414)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708164205830.png)]

开发自定义的view

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3sw4CD7L-1625837245415)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210708164655866.png)]

XML布局文件

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-TawvduCa-1625837245416)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709082143958.png)]

java代码

package com.example.self_define_ui;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.View;

public class Pikaqiu extends View {     //alt+回车快速引入包
    public float bitmapX;
    public float bitmapY;
    public Pikaqiu(Context contetxt) {
        super(contetxt);               //抽象类需实例化
        bitmapX = 290;
        bitmapY = 130;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = new Paint();
        Bitmap bitmap = BitmapFactory.decodeResource(this.getResources(),R.mipmap.img02); //将要画的图片
        canvas.drawBitmap(bitmap,bitmapX,bitmapY,paint); //这里的坐标只能用float
        if(bitmap.isRecycled()){
            bitmap.recycle();
        }
    }
}

package com.example.self_define_ui;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        FrameLayout frameLayout = (FrameLayout) findViewById(R.id.mylayout);   //添加自定义view
        Pikaqiu pikaqiu = new Pikaqiu(this);            //实例化皮卡丘
        pikaqiu.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                pikaqiu.bitmapX = event.getX();                 //获取皮卡丘的坐标
                pikaqiu.bitmapY = event.getY();
                pikaqiu.invalidate();                           //重画皮卡丘
                return true;
            }
        });
        frameLayout.addView(pikaqiu);                         //将皮卡丘添加到自定义view中
    }
}

运行成功

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CVsFy0Wt-1625837245417)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709082547211.png)]

布局管理器

布局管理器分类

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-z1oRu9a3-1625837245418)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709082830104.png)]

相对布局管理器

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-v6jQmHS9-1625837245419)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709083012299.png)]

XML文件补充

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-l8KdOX02-1625837245419)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709083646102.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3xSPOjQ6-1625837245420)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709085045271.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-bYO8Ozmu-1625837245421)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709090217533.png)]

RelativeLayout.LayoutParams

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-7eQBVhwf-1625837245422)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709085552295.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4ZmtLwFn-1625837245422)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709090706373.png)]

实例

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/img01"
    tools:context=".MainActivity">



    <TextView
        android:id="@+id/chx"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"            
        android:text="发布有Wideget的新版本,您现在就安装吗?"
        android:layout_centerInParent="true"
        android:textColor="@color/white"
        android:textSize="20dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/now"
        android:layout_toLeftOf="@+id/later"
        android:layout_below="@+id/chx"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="现在更新"
        android:background="@color/white">
    </Button>

    <Button
        android:id="@+id/later"
        android:layout_below="@+id/chx"
        android:layout_alignRight="@+id/chx"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="以后再说"
        android:background="@color/black">
    </Button>

</RelativeLayout>

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-mPGTS7bU-1625837245423)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709093405236.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4PkY4WR3-1625837245424)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709093533251.png)]

实现

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-tvR694cK-1625837245425)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709093621145.png)]

线性管理布局器

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-zHqMrUor-1625837245425)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709093757590.png)]

分类

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cll5wSU8-1625837245426)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709094101211.png)]

垂直线性管理布局器一页只能显示一列,当元素个数多于一页时,其他内容将不显示;同样,水平线性管理布局器一页只能显示一行,当元素个数多于一页时,其他内容将不显

orientation 和 gravity

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-SkiANbuj-1625837245426)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709100014991.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-8aslPfKu-1625837245427)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709100557272.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-eq7pN9b8-1625837245427)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709100612660.png)]

layout_weight

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-sy7evdxQ-1625837245428)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709101111366.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-si8CxJ2p-1625837245430)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709101827430.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-zxKCAiXu-1625837245431)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709101802783.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-laWLZTyr-1625837245432)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709101945233.png)]

实例

**登录界面 **

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawableLeft="@mipmap/user"
        android:hint=" QQ号/微信号/电话号码"
        android:paddingBottom="20dp"
        ></EditText>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:hint=" 密码"
        android:drawableLeft="@mipmap/pass"
        android:paddingBottom="20dp"
        ></EditText>

    <Button
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_centerHorizontal="true"
        android:text="登录"></Button>

    <TextView
        android:gravity="center"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:text="登录遇到问题?"
        android:paddingTop="10dp"
        ></TextView>

</LinearLayout>

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nAEwpdCd-1625837245433)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709110123394.png)]

实现

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3wXRVj9Q-1625837245434)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709110150518.png)]

帧布局管理器

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ZGa35ces-1625837245436)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709110323436.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-KntNVod8-1625837245437)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709110529706.png)]

分类

前景图像即永远处在最上层的图像

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-HUSXABdN-1625837245438)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709110623045.png)]

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:foreground="@mipmap/backgroud"
    android:foregroundGravity="bottom|right"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        android:background="#FF0000"
        app:layout_constraintTop_toTopOf="parent" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!Hello World!Hello World!"
        android:background="#FFFF00"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</FrameLayout>

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-DX9f8fn9-1625837245439)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709112729077.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-aA0NP4nT-1625837245439)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709112747585.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-FIv33ipG-1625837245440)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709112811168.png)]

表格布局管理器

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Cg3V7r3q-1625837245441)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709113314834.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-V3HAKf61-1625837245441)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709114143755.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xELVuenW-1625837245442)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709114206061.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-C1ugk5nw-1625837245443)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709114342341.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-o5mc5Kif-1625837245444)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709114351998.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-L9Ue5CX0-1625837245445)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709114602942.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-pzG00g6o-1625837245445)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709114652798.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-522ZU53C-1625837245446)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709114840232.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lFTXuJ7D-1625837245447)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709115045938.png)]

网格布局管理器

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-D4gFReUU-1625837245447)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709140026458.png)]

表格布局管理器和网格布局管理器的区别

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-6Aq1zMJ7-1625837245448)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709140214534.png)]

分类

在这里插入图片描述

GridLayout.LayoutParams

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-SAtbTxL3-1625837245450)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709141111673.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Z87Rb4Ji-1625837245450)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709141958006.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-XHb5FKFc-1625837245451)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709142039874.png)]

布局管理器嵌套

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OnSLh2LG-1625837245452)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709144222139.png)]

布局管理器的嵌套原则

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qj2GnYx2-1625837245453)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709144454159.png)]

实例

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        tools:context=".MainActivity">

        <ImageView
            android:id="@+id/imag1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_margin="10dp"
            android:src="@drawable/ic_launcher_background"></ImageView>

        <TextView
            android:id="@+id/text01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@+id/imag1"
            android:text="雪绒花"
            android:textColor="#00BFFF"
            android:textSize="30dp"></TextView>

        <TextView
            android:id="@+id/text02"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/text01"
            android:minLines="3"
            android:layout_toRightOf="@+id/imag1"
            android:text="祝我的亲人朋友们新年快乐!"
            android:textSize="20dp"></TextView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/text02"
            android:layout_toRightOf="@+id/imag1"
            android:text="昨天"
            android:textSize="20dp"></TextView>

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/editbox_dropdown_dark_frame"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/text02"
            />

    </RelativeLayout>

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
        <ImageView
            android:id="@+id/imag2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_margin="10dp"
            android:src="@drawable/ic_launcher_background"></ImageView>

        <TextView
            android:id="@+id/text03"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@+id/imag2"
            android:text="淡淡的印象"
            android:textColor="#00BFFF"
            android:textSize="30dp"></TextView>

        <TextView
            android:id="@+id/text04"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/text03"
            android:minLines="3"
            android:layout_toRightOf="@+id/imag2"
            android:text="“十六进制颜色代码,在RGB颜色模式中,颜色由三个值表示,表示组件的强度,红色!"
            android:textSize="20dp"></TextView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/text04"
            android:layout_toRightOf="@+id/imag2"
            android:text="昨天"
            android:textSize="20dp"></TextView>

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/editbox_dropdown_dark_frame"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/text04"
            />


    </RelativeLayout>

</LinearLayout>

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ycT17Aue-1625837245453)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709155432932.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nSABfjag-1625837245454)(C:\Users\Airex\AppData\Roaming\Typora\typora-user-images\image-20210709155515721.png)]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值