Android LinearLayout Why Gravity Not Work

本文详细解析了Android开发中LinearLayout布局的Gravity属性与Layout_Gravity属性的作用及区别。Gravity属性用于控制子视图内部内容的对齐方式,而Layout_Gravity属性则决定了子视图在其父布局中的位置。

Some Android Developer may not know well of Linearlayout . This may help you to know sth about the gravity of its chilren;

-------------------CONET ------------------

1) wahts the diffrence between "gravity " android "layout_gravity"?

gravity: is sth to itself;  this tell how you want its content to layout;   Its see a TextView ; provided its wd is 200; and its content (text ) measured wd is 150;   This Gravity setting will make its text align left ? top? center ? etc...


layout_gravity: is sth to its parent ;  this tells it;s parent how it wants to be layed out; Again this TextView in its parent Linearlayout; Provided parent wd is 300, ht is 400;


2) WHY Does my layout_gravity not work?

layout_gravity is sth relevent to its parent orentation;

If its orentation is horizontal , top , btm , center_vertical will be effective;

else if is vertical : left , right ,center_horizontal is effective;





----------------------END--------------------------

THAT ALL FOR TODAY ! MY POOR UBUNTU INPUT METHOD!!!

转载于:https://my.oschina.net/u/592116/blog/396102

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值