이미지가있는 Customer Spinner가 있습니다. 현재 모든 것이 두 가지 작은 것을 제외하고 의도적으로 작동하고 있습니다.Android Spinner 이미지 처리 완료
- 작은가는 선을 제외하고 회 전자가 표시되지 않습니다.
- 회 전자 항목은 회색 테두리가 약간 늘어납니다. 아래에 이러한 문제
내가 추가 한 스크린 샷 :
내가 원하는 것은 대신 위의 작은 얇은 라인의
- , 나는 빈 체크 박스를 원하는 아래 이미지처럼 이미지.
- Spinner 항목의 이미지 오른쪽이 회색 부분이므로 제거해야합니다.
나는이 두 가지 문제가 XML 파일에 있음을 알고 있지만 안드로이드에 익숙하지 않으며 항상 layout_widht/height와 혼동하는 경우가 있습니다.
activity_main.xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="com.example.testproject.MainActivity$PlaceholderFragment" >
<Spinner
android:id="@+id/spCheckbox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:drawSelectorOnTop="true" />
<ImageButton
android:id="@+id/ibtnCheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:contentDescription="@string/checkbox_content_description"
android:src="@drawable/checkbox_unchecked"
android:background="@drawable/transparent_background" />
</LinearLayout>
spinner_item.xml : 그래서
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/cbImage"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/transparent_button_background" />
</RelativeLayout>
(transparent_background.xml :
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@android:color/transparent" />
<item android:state_pressed="true" android:drawable="@android:color/transparent" />
<item android:drawable="@android:color/transparent" />
</selector>
여기
는 XML 파일 .. 어떤 layout_wid th/layout_height 적절한 결과를 얻으려면 변경해야합니까?
미리 답변 해 주셔서 감사합니다.
EDIT : 필자는 약간의 연구를했고 fill_parent를 match_parent로 바꾸기 시작했다. (같은 것이기 때문에 fill_parent는 API lvl.8 이후 사용되지 않기 때문에). 내 문제는 내 activity_main 레이아웃이 match_parent이어야 전체 화면이되고 Spinner, Spinner Item의 레이아웃 및 Spinner Item의 ImageView가 모두 wrap_content 여야합니다.
그래도 변경하면 두 가지 문제가 동일하게 유지됩니다. Spinner의 선택한 이미지를 표시하는 방법과 Spinner 항목의 회색 간격을 제거하는 방법을 알고 있다면 알려주십시오.
는