android形状不会改变大小

android形状不会改变大小,android,android-xml,android-styles,Android,Android Xml,Android Styles,请帮我在Android上做一个布局 flat\u btn\u hover.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#f45d5d"

请帮我在Android上做一个布局

flat\u btn\u hover.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#f45d5d"
        android:centerColor="#f45d5d"
        android:endColor="#f45d5d"/>
    <size android:height="@dimen/activity_bottom_height_hover"/>

    <stroke
        android:width="2dp"
        android:color="#f45d5d"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#232323"
        android:centerColor="#232323"
        android:endColor="#232323"/>
    <size android:height="@dimen/activity_bottom_height"/>
    <stroke
        android:width="1dp"
        android:color="#3e3e3e"/>
</shape>

flat\u btn\u bt\u normal.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#f45d5d"
        android:centerColor="#f45d5d"
        android:endColor="#f45d5d"/>
    <size android:height="@dimen/activity_bottom_height_hover"/>

    <stroke
        android:width="2dp"
        android:color="#f45d5d"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#232323"
        android:centerColor="#232323"
        android:endColor="#232323"/>
    <size android:height="@dimen/activity_bottom_height"/>
    <stroke
        android:width="1dp"
        android:color="#3e3e3e"/>
</shape>

flat\u btn\u bt.xml:

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/flat_btn_bt_normal" />
    <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/flat_btn_bt_normal" />
    <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/flat_btn_hover" />
    <item android:drawable="@drawable/flat_btn_bt_normal"/>
</selector>

然后,我为按钮设置背景:

<Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/flat_btn_bt"/>

但在工作时,它会改变颜色,而不会改变大小和布局。
您能告诉我如何更改大小吗?

默认情况下,形状会根据此处定义的尺寸按比例缩放到容器视图的大小

删除“大小”属性