Android 设置边界大小不正确

Android 设置边界大小不正确,android,android-custom-view,setbounds,Android,Android Custom View,Setbounds,我创建了一个自定义视图,并将背景设置为XML可绘制形状。目标是当用户单击视图时,视图的大小会增加,但是setBounds(0,0,width*2,height*2)会增加视图的大小,但会切断一些新视图,使其保持不变。我试过使用填充父对象,也试过使用特定的宽度和高度,但都不起作用 <package.ItemView android:layout_width="wrap_content" android:layout_height="wrap_content" andr

我创建了一个自定义视图,并将背景设置为
XML
可绘制形状。目标是当用户单击视图时,视图的大小会增加,但是
setBounds(0,0,width*2,height*2)
会增加视图的大小,但会切断一些新视图,使其保持不变。我试过使用
填充父对象
,也试过使用特定的宽度和高度,但都不起作用

<package.ItemView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_row="0"
    android:layout_column="0"
    android:layout_margin="0dp"
    android:background="@drawable/rounded_rect"
    android:layout_marginBottom="30dp"
    custom:text="yes"
    custom:sound="yes"
    custom:imagePath="@drawable/yes"
    custom:backgroundColor="#a0d80e"
    />