android–FrameLayout wrap_content

android–FrameLayout wrap_content,第1张

概述我有FrameLayout的问题.我想创建FrameLayout,它将拥有它的第一个孩子的身高,第二个孩子将获得它的父亲的身高(在本例中为100dp).但我得到的是FrameLayout正在填充屏幕(match_parent).这是我的xml.<FrameLayoutxmlns:android="http://schemas.android.com/apkes/android"a

我有FrameLayout的问题.我想创建FrameLayout,它将拥有它的第一个孩子的身高,第二个孩子将获得它的父亲的身高(在本例中为100dp).但我得到的是FrameLayout正在填充屏幕(match_parent).
这是我的xml.

<FrameLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content" >    <VIEw        androID:layout_wIDth="match_parent"        androID:layout_height="100dp" />    <VIEw        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent" /></FrameLayout>

我如何让FrameLayout像它的第一个孩子一样大,第二个孩子和它的父母一样大?我需要使用不同的父母吗?

解决方法:

使用relativeLayout肯定会为您提供您想要实现的目标:

  <relativeLayout        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content" >        <VIEw            androID:ID="@+ID/vIEw_ID_1"            androID:layout_wIDth="match_parent"            androID:layout_height="100dp" />        <VIEw            androID:ID="@+ID/vIEw_ID_2"            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:layout_alignBottom="@+ID/vIEw_ID_1"            androID:layout_aligntop="@+ID/vIEw_ID_1" />    </relativeLayout>

希望这可以帮助!

总结

以上是内存溢出为你收集整理的android – FrameLayout wrap_content全部内容,希望文章能够帮你解决android – FrameLayout wrap_content所遇到的程序开发问题。

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

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

原文地址: http://outofmemory.cn/web/1116403.html

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

发表评论

登录后才能评论

评论列表(0条)

保存