android解决视图超出屏幕范围显示问题

本文介绍了在Android开发中如何解决视图超出屏幕范围的问题,通过设置`android:clipChildren`属性和使用`HorizontalScrollView`来实现视图的完整显示。详细内容包括一个自定义布局的案例,该布局包含一个TextView,内容长度不固定,需要在动画中从屏幕右方滑动到左方。设置`android:clipChildren="false"`防止子布局被裁剪,同时自定义布局继承`HorizontalScrollView`以允许水平方向的滚动。
摘要由CSDN通过智能技术生成

发先一个ViewGroup超好用的属性。
android:clipChildren 是否裁剪子布局

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.dqs.shangri.clipchildren.MainActivity"
    android:clipChildren="false">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="20dp"
        android:layout_marginTop="200dp"
        android:background="@color/colorAccent"
        android:gravity="bottom">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Hello World!"
            android:layout_gravity="center_vertical"/>

        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值