场景

Android布局管理器-使用LinearLayout实现简单的登录窗口布局:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103838995

帧布局管理器FrameLayout

 

 

实现效果

 

 

 

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

将activity_main.xml修改为FrameLayout

 

 

然后通过

 android:foreground="@drawable/dog"

 

设置其前景照片,就是位于所有控件的最上方的照片。

其中照片是位于res/drawable下的dog.jpg

 

 

然后通过

android:foregroundGravity="right|bottom"

 

设置前景照片位置,多个位置使用|分割,这里是设置位于右边和下边。

然后依次设置不同大小的TextView以及不同的北京颜色,实现层叠效果。

完整代码如下

<?xml version="1.0" encoding="utf-8"?>"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="@drawable/dog"    android:foregroundGravity="right|bottom"    tools:context=".MainActivity">    <TextView        android:layout_width="280dp"        android:layout_height="280dp"        android:text="蓝色背景"        android:textColor="#FFFFFF"        android:background="#FF0000FF"       />    <TextView        android:layout_width="230dp"        android:layout_height="230dp"        android:text="天蓝色背景"        android:textColor="#FFFFFF"        android:background="#FF0077FF"        />    <TextView        android:layout_width="180dp"        android:layout_height="180dp"        android:text="水蓝色背景"        android:textColor="#FFFFFF"        android:background="#FF00B4FF"        />

更多相关文章

  1. Android中其中一个Activity可以对另一个Activity的xml文件中的Ed
  2. Android(安卓)带清空按钮的EditText
  3. Android全局捕获崩溃异常记录
  4. ActionBar 自定义布局定义
  5. Android(安卓)TextView中文字设置超链接、颜色、字体
  6. Android(安卓)Studio 设置自动配置git忽略
  7. 利用 Android(安卓)Studio 和 Gradle 打包多版本APK
  8. Android的ScrollView简单使用实例(附Demo)
  9. [置顶] Android(安卓)L中的RecyclerView 、CardView 、Palette的

随机推荐

  1. 《解析 Google Android(安卓)DSK-智能手
  2. Android(安卓)Studio导入github下载的工
  3. android邮箱开发可以参考的相关开源资料
  4. Linux/Ubuntu下android设备添加adb驱动
  5. android 透明对话框
  6. android 常见分辨率(mdpi、hdpi 、xhdpi、
  7. Android系统体系结构概要
  8. android studio怎么导入appcompat-v7
  9. 悬浮顶层控件不受ScrollView影响
  10. Android Handle消息机制:秒懂Looper、Hand