android - 如何将项目位置设置为底部中心 launchbackground.xml
问题描述
我试图在我的应用启动画面中添加一个图像,但我不知道如何将它的重力设置为底部中心。有我的代码:
<item
android:width="265dp"
android:height="160dp"
android:drawable="@mipmap/bottomsplash"
android:gravity="bottom" />
底部重力将其设置在左下方,但我希望它位于底部中心。
解决方案
尝试这个 :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:width="265dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:height="160dp"
android:drawable="@mipmap/bottomsplash"
android:layout_marginBottom="50dp" />
</RelativeLayout>
推荐阅读
- reactjs - React 元素被渲染两次
- perl - 如何在 perl 中切换 NVM 环境
- reactjs - 仅使用对象 id 和 lastUpdate 来区分 React 中的 useEffect
- sql - 以下查询之间的语法有什么区别?
- android - Koltin - 创建房间数据库 Android Studio 时没有足够的信息来推断类型变量 t 和注释问题
- python - 如何一起使用 c++ 和 python 并将它们分发到没有安装 python 的系统?
- mysql - 创建存储过程时 MySQL 语法错误
- jestjs - 如何使用 jest 在存储库 typeorm nestjs 中模拟函数
- angular - 在链接的 Angular 应用程序中构建 Angular 库和效果
- java - 应用程序不读取配置服务器 Spring Cloud