如何获得一个视图,而不是其母公司大? [英] How to get a view larger than its parent?
本文介绍了如何获得一个视图,而不是其母公司大?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个显示/隐藏菜单按钮顶吧。我想定义最上面一栏,按钮,然后在相同的布局菜单。
I have a top bar with a show/hide menu button. I would like to define the top bar, the button and the menu in the same layout.
我试着用最上面一栏的高度布局,但菜单被剪切并是不可见的。这有可能有一个观点比其父大。否则,有什么标准的方式来做到这一点?
I tried a layout with the height of the top bar, but the menu is clipped and is not visible. Is that possible to have a view larger than its parent. Otherwise, what's the standard way to do that?
推荐答案
对于你的问题:是的,它是可能的。简单的例子:
For your question: Yes It's possible. Simple example:
<?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
。
希望其帮助。
这篇关于如何获得一个视图,而不是其母公司大?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文