Android 无法在弹出式活动中创建自定义按钮
我以前做过定制按钮,它们工作得很好。但这件事有点不对劲。它不占用我指定的可拔模长度。活动布局文件:Android 无法在弹出式活动中创建自定义按钮,android,android-custom-view,Android,Android Custom View,我以前做过定制按钮,它们工作得很好。但这件事有点不对劲。它不占用我指定的可拔模长度。活动布局文件: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent" android:layout_height="match_parent"> &
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawable="@drawable/button_continue"
android:id="@+id/continue_button"
android:onClick="goToStart"
android:layout_gravity="center_vertical"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="86dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/dialogue_textView"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
如果你能帮忙,那太好了 这是因为您在布局文件中设置了错误的属性。它应该是android:background且不可绘制。在xml文件中更改:
android:background="@drawable/button_continue"
代替:
android:drawable="@drawable/button_continue"
android:background="@drawable/button_continue"
android:drawable="@drawable/button_continue"