我已经通过了十几个这样的例子,与此有关的十几个错误,并由于某种原因,我的图像不工作。图像作为按钮背景 - 碰撞和工作
所有图像小于800x800像素,小于200kb,全部为.png格式。
我有几个片段与每个片段中的几个图像。 我已经添加了带有如下背景图片的按钮。
<LinearLayout 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"
android:orientation="vertical">
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Please select" />
<Button
android:id="@+id/broad_btn"
android:layout_width="@android:dimen/notification_large_icon_width"
android:layout_height="@android:dimen/notification_large_icon_height"
android:background="@drawable/broad"
android:tag="broad"
android:text="Broad" />
</Linearlayout>
现在我所拥有的第二个片段上的图像与上面的图片没什么区别。 但是当我尝试在后台使用它时,我的应用崩溃了。
但是,如果我在第一页上使用“问题”图像 - 那么它工作正常。 只有当我将这张图片移动到第二个片段时,它才会失败。
第二的代码是
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
<Button
android:id="@+id/late_btn"
android:layout_width="@android:dimen/notification_large_icon_height"
android:layout_height="@android:dimen/notification_large_icon_height"
android:background="@drawable/late"
android:text="Long" />
</LinearLayout>
什么错误你好吗? –