Android Studio에서 이미지 버튼을 만들려고합니다. Designer 미리보기에는 이미지가 올바르게 표시되지만 앱을 실행하면 버튼에 이미지가 없습니다. 빈 버튼은 가능한 한 작습니다.
내가 시도한 것 :
이 중 어느 것도 나를 위해 일하지 않았습니다. 전체 기능이 고장난 것 같습니다. 흥미로운 부분은 이미지를 설정할 때 이미지 버튼의 배경으로 작동한다는 것입니다. 그러나 그것은 "버튼 모양"을 잃어 버렸으므로 나에게는 해결책이 아닙니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<org.osmdroid.views.MapView android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/search_ui"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:padding="1dp"
android:background="@color/white"
android:orientation="horizontal">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_menu_manage"
android:id="@+id/imageButton"/>
<EditText android:id="@+id/edit_search_string"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/search_string" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send"
android:onClick="myClickHandler"/>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:background="@color/white"
android:layout_below="@id/search_ui">
<TextView
android:id="@+id/display"
android:textSize="16sp"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Text" />
</LinearLayout>
srcCompat 대신 src 만 사용하고 작동하는지 확인하십시오.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다