当在FrameLayout中查看时,layout_marginLeft在Android API <11上正常工作

当在FrameLayout中查看时,layout_marginLeft在Android API <11上正常工作,第1张

概述当我使用layout_marginLeft或从代码设置左边距时,它可以作为layout_marginRight使用.当我在FrameLayout中放置View with layout_marginLeft或在 Android API上放置布局根目录时,会出现此行为. 11. <?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:andr 当我使用layout_marginleft或从代码设置左边距时,它可以作为layout_marginRight使用.当我在FrameLayout中放置VIEw with layout_marginleft或在 Android API上放置布局根目录时,会出现此行为. 11.

<?xml version="1.0" enCoding="utf-8"?><FrameLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"                androID:orIEntation="vertical"                androID:layout_wIDth="match_parent"                androID:layout_height="wrap_content"                androID:layout_marginleft="50dp"                androID:background="#77cc99"        >    <FrameLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_marginleft="50dp"        androID:background="#eebbaa">        <TextVIEw                androID:layout_wIDth="fill_parent"                androID:layout_height="wrap_content"                androID:text="Hello World,MyActivity"                />        </FrameLayout></FrameLayout>
解决方法 默认情况下,对于FrameLayout,androID:layout_gravity属性设置为“left”.如果你想使用androID:layout_marginleft你应该改变它:

<?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="wrap_content"    androID:layout_gravity="top"    androID:layout_marginleft="50dp"    androID:background="#77cc99"    androID:orIEntation="vertical" >    <FrameLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_gravity="top"        androID:layout_marginleft="50dp"        androID:background="#eebbaa" >        <TextVIEw            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"            androID:text="Hello World,MyActivity" />        </FrameLayout></FrameLayout>
总结

以上是内存溢出为你收集整理的当在FrameLayout中查看时,layout_marginLeft在Android API <11上正常工作全部内容,希望文章能够帮你解决当在FrameLayout中查看时,layout_marginLeft在Android API <11上正常工作所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1121987.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存