- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我有一个黄色 RelativeLayout
包含一个较高的红色 LinearLayout
。
为了让整个LinearLayout
可见,我设置了android:clipChildren="false"
,但这并没有按预期工作:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="#FFFF00"
android:clipChildren="false" >
<LinearLayout
android:layout_width="50dp"
android:layout_height="100dp"
android:background="#FF0000"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
android:clipChildren="true"
:
红色的LinearLayout
按预期剪裁
android:clipChildren="false"
:
LinearLayout
高度被剪裁,布局中设置的宽度不被遵守。
怎么了?
编辑
如果我将容器包装在 LinearLayout
中,并且两个尺寸都与其父级匹配,我会得到相同的结果(我检查了 LinearLayout 容器的容器是否填满了整个屏幕)。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="#FFFF00"
android:clipChildren="false" >
<LinearLayout
android:layout_width="50dp"
android:layout_height="100dp"
android:background="#FF0000"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
</LinearLayout>
编辑 2
如果我将 android:clipChildren="false"
属性放在父 LinearLayout 中,我会得到以下信息:
最佳答案
android:clipChildren="false"
允许每个 child 在其自己的边界之外,在 parent 之内进行绘制。它不允许 child 在 parent 本身之外进行绘画。为此,您需要在祖 parent (以及)上设置 android:clipChildren="false"
。
我认为您所看到的颜色只是因为颜色没有固有的界限。如果没有任何东西剪裁它们,颜色就会永远消失。我的理论是,如果你使用拉伸(stretch)的 1x1 像素图像而不是颜色,情况会有所不同。
关于android - 无法让 clipChildren=false 属性起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15975725/
我在裁剪约束布局 View 时遇到问题。 这是我的xml布局代码 deck_card_corner_radius 没有图像我得到了这个 no image src 有图片
我有一个工具栏,上面有一些显示文本的静态子控件(例如:“查找”...)。该工具栏上有 2 个编辑控件。当我调整主窗口大小时,工具栏的某些部分出现闪烁。所以我尝试使用 WS_CLIPCHILDREN 作
我怎样才能让我的 RecyclerView 的子级像 ViewGroup 的子级一样相互绘制,通常使用 clipChildren="false"? 我在我的 RecyclerView 中使用了 Car
我想要实现的是这样的布局: 我曾尝试使用这段代码来实现那样的图像,但不幸的是,我失败了。这是我的代码 fragment :
我有自定义的 EditText,我注意到他们离开 parent 时背景画错了。所以我在他们的 parent 身上使用了 android:clipChildren="false" 。那很好用。现在,当它
在我的应用程序中,我尝试使用动画来移动图像。当我尝试为图像设置动画时,即使我在每个 xml block 中使用 clipChildren false 最佳答案 RelativeLayout
这个问题在这里已经有了答案: clipChildren is not working even though set to false? (6 个回答) 关闭去年。 我有一个黄色 RelativeLa
我有一个将 clipToPadding 和 clipChildren 都设置为 false 的 ViewPager。寻呼机中的项目有一个投影效果,绘制在每个项目下方,超出其边界。当寻呼机是静态的时,这
我想要一个 CardView,其中包含一个与 CardView 的左边框重叠的 ImageView。我想通过给 ImageView 一个负边距来做到这一点。通过设置 clipChildren="fal
我正在尝试为 container LinearLayout (20dp) 和 btn 按钮 (20dp) 设置动画(将它们向右移动),但它们在main LinearLayout (40dp)。我在两者
我有一个问题。 我们有布局自定义框架布局,具有缩放和平移功能 public class MyFrameLayout extends FrameLayout { ... @Override protec
我是一名优秀的程序员,十分优秀!