[英]Images won't show and/or won't work with buttons
我目前添加了一張圖片,但它是灰色的。 按鈕也不會按預期工作,但這可能是圖像損壞的原因(因為代碼似乎正確)。
U可以通過android:background="@android:drawable/..."
屬性來更改按鈕的android:background="@android:drawable/..."
。 但我認為您想獲取switch
或ToogleButton
因此它應該是不同的View。
1>您可以為此使用Switch
。
2>如果要顯示布局,請將ConstraintLayout
更改為LinearLayout
。
喜歡
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:src="@mipmap/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.