In xml, ImageView is not a button, it's just for image viewing, but I don't know why I can't see it.
Linear Layout is acting as a button, covering the image view and the text view below it.
At the Android studio,
You can see it well, but if you actually turn it around (Amulex)
It pops up like this.
The text view above is right that I can't see it because I touched something in the Java file, but the image view doesn't have any function, so I don't know if you can see it.
Just in case, I'll put the xml sauce on the part with the image view.
...
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<LinearLayout
android:id="@+id/setting_btn_check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:onClick="onClick"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
app:srcCompat="@drawable/icon_btn_ok" />
<TextView
android:id="@+id/textView24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK" />
</LinearLayout>
<LinearLayout
android:id="@+id/setting_btn_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:gravity="center"
android:layout_marginLeft="120dp"
android:orientation="vertical">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
app:srcCompat="@drawable/icon_btn_delete_circle" />
<TextView
android:id="@+id/textView25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Please let me know if you know the reason.
android
Try the android:src property instead of the app:srcCompat property.
The app:srcCompat property is a property of the AppCompat library, so if Activity does not extend AppCompatActivity.
If you're going to do it with a button, instead of ImageView, use ImageButton Try android:src = "@drawable/icon_btn_delete_circle" If the size of the image file is larger than the image view, the image view is truncated We recommend adding android:scaleType="fitXY".
© 2024 OneMinuteCode. All rights reserved.