如图,ImageView设置layout_marginTop="-100dp" ,
但是被上面的LinearLayout挡住了,怎么显示出来
网上看到有clipChildren这个属性,但是试了下还是不显示.
帮忙看一下怎么能让ImageView显示在最顶层
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:gravity="center">
<ImageView
android:id="@+id/wine"
android:layout_width="80dp"
android:layout_height="250dp"
android:layout_marginTop="-100dp"
android:src="@drawable/img_3_3_wine_photo"/>
</LinearLayout>
想达到下面这个效果
解决了clipChildren的设置应该放在它爷爷节点的下面!!!!!
感谢这篇文章https://blog.csdn.net/corachay/article/details/74829402
很多人都反馈设置了属性不生效就是这一点原因,如果在没有爷爷节点的情况下设置在根节点,View就会显示超出屏幕。
把遮挡的 用户交互打开
两个图片是平分屏幕宽的可以这样布局:使用权重
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/fatierenxingming" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/fatierenxingming" />
你设置marginTop="-100dp"这个自然是会被遮挡的,你想要什么样的效果。
用Relativelayout呗
marginTop="-100dp" 使用这个肯定会被当住的 你可以使用relativeLayout 或者 framlayout 都可以达到你的效果