2014-10-04 4 views
2

여기에 문제가 있습니다. Google 지역 정보를 표시하는 ArrayList가 있습니다. ArrayList Value를 Textview로 설정하려고합니다. 그러나 Google 장소의 주소가 길 때 텍스트 주소가 전체 주소를 표시하지 않습니다. 나는 textview의 다음 줄에 전체 주소를 보여주고 싶다. 여기ArrayList의 값을 여러 줄로 설정하는 방법

private List<Address> getLocationInfo(String address) { 

List<Address> addrs = new ArrayList<Address>(); 
      String query = "http://maps.google.com/maps/api/geocode/json?address=" + address.replaceAll(" ","%20") 
        +"&components=country:"+appprefs.getString(Utils.CLIENT_COUNTRYCODE, "")+ "&sensor=false"; 
      Address addr = null; 
      HttpClient client = new DefaultHttpClient(); 
      HttpGet httpGet = new HttpGet(query); 

      HttpResponse response; 
      StringBuilder stringBuilder = new StringBuilder(); 

XML 코드

<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/textAutoComplete" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:gravity="center_vertical|left" 
android:padding="5dp" /> 
+0

Patle이 링크를 확인 https://chat.stackoverflow.com/rooms/94048/android-reliver 이것은 나에 의해 만들어진 대화방이다. –

+0

다른 사용자가받은 대답을 수락하면 스택 오버플로가 증가합니다. 당신이 만든 대화방에서 최소 20 명 이상의 평판이 필요하기 때문입니다. msg를 읽으면 나에게 대답 해주세요. –

답변

0

샘플 코드를입니다 텍스트 뷰의 만일 Singleline 속성을 사용하고 false로 설정합니다.

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/textView1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:singleLine="false" /> 

TextView에 입력하는 텍스트가 짧으면 n 줄까지 자동으로 확장되지 않습니다. 당신은 항상 관계없이 텍스트의 길이의 라인의 일부 N 번호를하기 위해 텍스트 뷰를 원하는 경우에, 안드로이드를 설정 : 라인 속성 :

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/textView1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:singleLine="false" 
    android:maxLines="MAX_NUMBER_OF_LINES_YOU_WANT" 
    android:lines="NUMBER_OF_LINES_YOU_WANT" /> 
관련 문제