1
請幫我在Android上進行佈局。android形狀不會更改大小
flat_btn_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>
flat_btn_bt_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="#232323"
android:centerColor="#232323"
android:endColor="#232323"/>
<size android:height="@dimen/activity_bottom_height"/>
<stroke
android:width="1dp"
android:color="#3e3e3e"/>
</shape>
flat_btn_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"/>
但工作時,它改變了顏色,並不會改變大小布局。 你能告訴我如何改變尺寸嗎?