首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Android梅花布局

Android梅花布局

作者头像
是阿超
发布2021-10-15 16:22:07
发布2021-10-15 16:22:07
8150
举报
文章被收录于专栏:CSDNCSDN

项目目录

MainActivity.java

代码语言:javascript
复制
package top.gaojc.myplumblossom;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

activity_main.xml

代码语言:javascript
复制
<?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"
    tools:context=".MainActivity">

    <!-- 中间的-->
    <ImageView
        android:id="@+id/center"
        android:layout_width="200dp"
        android:layout_height="80dp"
        android:src="@drawable/three"
        android:layout_centerInParent="true"/>

    <!-- 上边-->
    <ImageView
        android:layout_width="80dp"
        android:layout_height="200dp"
        android:src="@drawable/one"
        android:layout_above="@id/center"
        android:layout_centerHorizontal="true"/>

    <!-- 左边-->
    <ImageView
        android:layout_width="80dp"
        android:layout_height="200dp"
        android:src="@drawable/two"
        android:layout_toLeftOf="@id/center"
        android:layout_centerVertical="true"/>

    <!-- 右边-->
    <ImageView
        android:layout_width="80dp"
        android:layout_height="200dp"
        android:src="@drawable/four"
        android:layout_toRightOf="@id/center"
        android:layout_centerVertical="true"/>

    <!-- 下边-->
    <ImageView
        android:layout_width="80dp"
        android:layout_height="200dp"
        android:src="@drawable/five"
        android:layout_below="@id/center"
        android:layout_centerHorizontal="true"/>

</RelativeLayout>

AndroidManifest.xml

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="top.gaojc.myplumblossom">

    <application
        android:allowBackup="true"
        android:icon="@drawable/four"
        android:label="@string/app_name"
        android:roundIcon="@drawable/four"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

页面效果

获取代码

点击下载

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021/09/20 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 项目目录
    • MainActivity.java
    • activity_main.xml
    • AndroidManifest.xml
  • 页面效果
  • 获取代码
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档