2012-10-23 2 views
1

AutoCompleteTextView 드롭 다운 요소에서 세 줄 이상의 텍스트를 줄 바꿈 할 수 없습니다.AutoCompleteTextView 강제로 3 줄 이상의 텍스트를 줄 바꿈하는 요소를 드롭 다운하는 방법?

당신이 볼 수 있듯이 :

drop-down before selection

drop-down after selection

첫 번째 이미지 (드롭 다운 요소)의 텍스트가 사라,하지만 난 그게 더 라인으로 포장 실 거예요.

편집 :이 드롭 다운 항목 나는이 작업을 수행 할 수있는 방법

<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/text1" 
    style="?android:attr/dropDownItemStyle" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:singleLine="false" 
    android:lines="4" 
    android:minLines="4" 
    android:textSize="10sp"/> 

내 XML 코드는?

+0

는 u는 minLines을 변경 시도 되세요 속성? – meh

+0

@ user1597833 예! 안돼 ... – wildnove

+0

안드로이드 설정 : layout_height = "wrap_content" –

답변

0

해결! 내 레이아웃 dropdown_multiline_item.xml 코드가 될 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" > 

    <TextView 
     android:id="@+id/textContainer" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:lines="3" 
     android:gravity="center_vertical" 
     android:padding="5dp" 
     android:textColor="#000" 
     android:textSize="10sp" /> 

</LinearLayout> 

비밀은 두 가지 방법에 있던 (어댑터로) :

[...] 

@Override 
public void bindView(View view, Context context, Cursor cursor) { 
    final String text = convertToString(cursor); 
    ((TextView) view.findViewById(R.id.textContainer)).setText(text); 
} 

@Override 
public View newView(Context context, Cursor cursor, ViewGroup parent) { 
    final LayoutInflater inflater = LayoutInflater.from(context); 
    final View view = inflater.inflate(R.layout.dropdown_multiline_item, parent, false); 
    return view; 
} 

[...] 

희망이 사람을 도움이 될 것입니다

0

TextView를 올바른 모양 (선, ellipsize, maxLines, minLines 등)으로 만드는 데 필요한 모든 속성이있는 XML 레이아웃으로 정의하십시오. android:completionHintView 속성을 사용하여 정의한 텍스트 뷰를 표시하도록 드롭 다운을 설정합니다.

+0

나는 당신이 볼 수 있듯이 내 코드에서)하지만 아무것도 변경되지 않았습니다 ... – wildnove

관련 문제