2009-12-11 9 views

답변

4

, 나는 당신이 CheckedTextView을 사용할 수 있습니다, 대신

1

@Arutha mentioned in the above answer처럼 CheckTextView를 사용합니다. 이것은 내장 된 안드로이드 레이아웃 (나는 here을 게시로)를 사용하여 수행 할 수 있습니다 - android.R.layout.simple_list_item_single_choice :

<?xml version="1.0" encoding="utf-8"?> 
<!-- Copyright (C) 2008 The Android Open Source Project 

    Licensed under the Apache License, Version 2.0 (the "License"); 
    you may not use this file except in compliance with the License. 
    You may obtain a copy of the License at 

      http://www.apache.org/licenses/LICENSE-2.0 

    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License. 
--> 

<CheckedTextView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/text1" 
    android:layout_width="match_parent" 
    android:layout_height="?android:attr/listPreferredItemHeightSmall" 
    android:textAppearance="?android:attr/textAppearanceListItemSmall" 
    android:gravity="center_vertical" 
    android:checkMark="?android:attr/listChoiceIndicatorSingle" 
    android:paddingStart="?android:attr/listPreferredItemPaddingStart" 
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" /> 

당신이 그것을 수정하려면, 새 XML 파일에 위의 내용을 복사하여 붙여 넣을 수 있습니다, 다음 <include> 태그를 사용하여 다른 레이아웃 (Apache 2.0 License 아래)에 포함하십시오. 목록 항목으로 사용할 수도 있고 변경하지 않을 수도 있습니다.