要实现这个效果,可以使用LinearLayout的属性android:clipChildren="false"来设置LinearLayout容器不剪裁其子View。这样,即使子View的宽度超出了LinearLayout容器的宽度,超出部分也会正常绘制,只是在界面上看不到而已。

示例代码如下:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clipChildren="false">

    <!-- 子View -->
    ...

</LinearLayout>

通过设置android:clipChildren="false"属性,LinearLayout容器的子View就可以超出容器宽度而正常绘制了。

Android LinearLayout容器中某宽度超出容器宽度也正常绘制超出部分看不到没关系怎么做?

原文地址: https://www.cveoy.top/t/topic/iaqf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录