首页 > 系统 > Android > 正文

[Android新手学习笔记20]-FrameLayout帧布局

2019-11-09 16:05:57
字体:
来源:转载
供稿:网友

应用场景较少,碎片会使用。

<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent">    <Button        android:id="@+id/button1"        android:text="Button"        android:textAllCaps="false"        android:layout_width="wrap_content"        android:layout_height="wrap_content" />    <TextView        android:id="@+id/text_view"        android:text="TextView很长很长"        android:layout_width="wrap_content"        android:layout_height="wrap_content" /></FrameLayout>

这种布局会重叠在左上角摆放。可以通过android:layout_gravity来控制对齐。


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表