找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 32|回复: 6

layouts

[复制链接]

295

主题

38

回帖

1265

积分

管理员

积分
1265
发表于 2024-2-26 17:12:52 | 显示全部楼层 |阅读模式
view groups包括

LinearLaout
ViewGroup to use for a strictly horizontal list-style arrangement of views.
ViewGroup that is useful for a strictly vertical list-style arrangement of views.


ConstraintLayout
A ViewGroup where elements can be arranged freely, are placed by the system based on constraints, and may adapt in size based on screen size and orientation.




ScrollView


ViewGroup to use when you need to scroll a single view vertically.






回复

使用道具 举报

295

主题

38

回帖

1265

积分

管理员

积分
1265
 楼主| 发表于 2024-2-26 19:30:20 | 显示全部楼层
  1. android:layout_gravity="center_horizontal"
复制代码


属性用于在父容器中水平居中对齐一个视图
回复

使用道具 举报

295

主题

38

回帖

1265

积分

管理员

积分
1265
 楼主| 发表于 2024-2-27 12:26:45 | 显示全部楼层
  1.         android:layout_alignParentBottom="true"
  2.         android:layout_marginLeft="20dp"
  3.         android:layout_marginBottom="6dp"
复制代码


这个定位在底部牛逼
回复

使用道具 举报

295

主题

38

回帖

1265

积分

管理员

积分
1265
 楼主| 发表于 2024-2-27 22:13:35 | 显示全部楼层
  1.         <activity
  2.             android:name=".MainActivity"
  3.             android:exported="true"
  4.             android:label="@string/app_name"
  5.             android:theme="@style/Theme.Aboutme4">
  6.             <intent-filter>
  7.                 <action android:name="android.intent.action.MAIN" />

  8.                 <category android:name="android.intent.category.LAUNCHER" />
  9.             </intent-filter>
  10.         </activity>
复制代码



如果建立activity运行APP报错unable to determine activity name就对照上面代码修改Manifest文件
回复

使用道具 举报

295

主题

38

回帖

1265

积分

管理员

积分
1265
 楼主| 发表于 2024-3-17 23:02:53 | 显示全部楼层
Fixed constraint固定约束A constraint that is specified using a hard-coded number.
Adaptable constraint可适应约束A constraint that defines a relationship in relative and weighted terms.
Absolute positioning绝对定位Positioning is numerical, such as the position in x, y coordinates.
Relative positioning相对定位Views are positioned by specifying  relationship to other views.



Fixed constraint(固定约束):这是指使用硬编码的数值来指定约束条件。例如,将视图的宽度或高度设置为具体的数值。

Adaptable constraint(可适应约束):这是指使用相对和权重的方式来定义约束条件。例如,使用权重来调整视图在容器中的相对大小或位置。

Absolute positioning(绝对定位):这是指使用数值坐标(如 x 和 y 坐标)来确定视图的位置。

Relative positioning(相对定位):这是指通过指定与其他视图的关系来确定视图的位置。
回复

使用道具 举报

295

主题

38

回帖

1265

积分

管理员

积分
1265
 楼主| 发表于 2024-3-17 23:19:38 | 显示全部楼层
Spread chain
Packed chain
Spread inside chain
Packed chain with bias
Weighted chain
Spread chain(扩展链):在 ConstraintLayout 中,当一组视图以链的形式连接在一起时,可以使用 Spread chain 来指定它们之间的间隔。这将使得链中的视图在水平或垂直方向上均匀分布,并保持相等的间隔。

Packed chain(紧凑链):与 Spread chain 相反,Packed chain 会将链中的视图紧凑排列在一起,使它们之间的间隔最小化。这将使得链中的视图尽可能地靠近彼此。

Spread inside chain(链内扩展):当链中的视图的宽度或高度不相等时,可以使用 Spread inside chain 来指定它们之间的间隔。这将使得链中的视图在水平或垂直方向上均匀分布,并保持相等的间隔,同时考虑到视图的不同尺寸。

Packed chain with bias(带有偏移的紧凑链):与 Packed chain 类似,但可以通过设置 bias(偏移)来控制链中的视图在链的起始或结束位置的偏移程度。这可以用于在紧凑链中创建一定的偏移效果。

Weighted chain(权重链):在 ConstraintLayout 中,可以使用权重来调整链中视图的相对大小或位置。通过为链中的视图设置不同的权重值,可以实现视图在链中按比例分配空间的效果。
回复

使用道具 举报

295

主题

38

回帖

1265

积分

管理员

积分
1265
 楼主| 发表于 2024-3-17 23:29:12 | 显示全部楼层
Spread chain,Elements are spread equally in space.
Packed chain,Elements are packed to use minimum space.
Spread inside chain,Elements are spread to use available space with head and tail attached to the parent.
Packed chain with bias,Elements are packed to use minimum space and are moved on their axis depending on bias.
Weighted chain,Elements are spread to use available space with head and tail attached to the parent.
Spread chain(扩展链):在 ConstraintLayout 中,当一组视图以链的形式连接在一起时,可以使用 Spread chain 来指定它们之间的间隔。这将使得链中的视图在水平或垂直方向上均匀分布,并保持相等的间隔。

Packed chain(紧凑链):与 Spread chain 相反,Packed chain 会将链中的视图紧凑排列在一起,使它们之间的间隔最小化。这将使得链中的视图尽可能地靠近彼此。

Spread inside chain(链内扩展):当链中的视图的宽度或高度不相等时,可以使用 Spread inside chain 来指定它们之间的间隔。这将使得链中的视图在水平或垂直方向上均匀分布,并保持相等的间隔,同时考虑到视图的不同尺寸。

Packed chain with bias(带有偏移的紧凑链):与 Packed chain 类似,但可以通过设置 bias(偏移)来控制链中的视图在链的起始或结束位置的偏移程度。这可以用于在紧凑链中创建一定的偏移效果。

Weighted chain(权重链):在 ConstraintLayout 中,可以使用权重来调整链中视图的相对大小或位置。通过为链中的视图设置不同的权重值,可以实现视图在链中按比例分配空间的效果。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|外汇论坛 ( 粤ICP备16021788号 )

GMT+8, 2024-4-28 06:03 , Processed in 0.074352 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表