gpt4 book ai didi

android - 如何获得比父 View 更大的 View ?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:50:16 30 4
gpt4 key购买 nike

我有一个带有显示/隐藏菜单按钮的顶部栏。我想在同一布局中定义顶部栏、按钮和菜单。

我尝试了顶部栏高度的布局,但菜单被剪裁并且不可见。是否有可能拥有比其父级更大的 View 。否则,执行此操作的标准方法是什么?

enter image description here

最佳答案

对于您的问题:是的,这是可能的。简单示例:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
>

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f0f"
android:layout_marginLeft="-50dp"
android:layout_marginRight="-50dp"
/>
</LinearLayout>

ImageViewWidth == LinearLayoutWidth + 100dp

希望对您有所帮助。

关于android - 如何获得比父 View 更大的 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15967096/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com