2011-02-05 5 views
0

안녕하세요. Sms app 마녀가 Inbox의 콘텐츠를 보여줍니다. TextView를 사용하고 있지만 화면에 문제가 있습니다. 모든 SMS를 볼 수는 없지만 화면 크기는 SMS 만 볼 수 있습니다. 아래로 스크롤하십시오. 스크롤을 사용하여 모든 문자를 볼 수있는 방법은 무엇입니까? 또는 TextView에서 지원됩니까? 죄송하지만 제 영어는 제가 체코 인입니다. 감사Sms Inbox - TextView

소스 코드 :

import android.app.Activity; 
import android.database.Cursor; 
import android.net.Uri; 
import android.os.Bundle; 
import android.widget.TextView; 

    public class Mynew extends Activity { 

     @Override 
     public void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      TextView view = new TextView(this); 
      Uri uriSMSURI = Uri.parse("content://sms/inbox"); 
      Cursor cur = getContentResolver().query(uriSMSURI, null, null, null, null); 
      String sms = ""; 
      while (cur.moveToNext()) { 
       String address = cur.getString(cur.getColumnIndex("address")); 
       String body = cur.getString(cur.getColumnIndexOrThrow("body")); 
       sms += "From :" + address + " : " + body+"\n";   
      } 
      view.setText(sms); 
      setContentView(view); 
     } 
    } 

XML을 :

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

    android:text="@string/hello" 
    android:id="@+id/row_entry"/> 

/> 


</LinearLayout> 

매니페스트 :

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="New.test" 
     android:versionCode="1" 
     android:versionName="1.0"> 
    <application android:icon="@drawable/icon" android:label="@string/app_name"> 
     <activity android:name=".Mynew" 
        android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

    </application> 



<uses-permission android:name="android.permission.READ_SMS"></uses-permission> 
</manifest> 

답변

0

서라운드있는 ScrollView와 텍스트 뷰.

아니면 목록에 유용한 일을 할 필요가 있다면 당신이 원하는 가능성이 약의 ListView

+0

예, 내가 ListView에이 aplication를 만들기 위해 노력하고 알아,하지만하지 않았다 work.Can 내가 여기에 게시 소스 코드를 listview로 확인해 주시겠습니까? – Adam

+0

죄송합니다. 이것이 작동하는 방식은 아닙니다. 왜 코드가 작동하지 않는지 모르는 코드를 게시 할 수 있습니다. 그러나 문제를 골라 내서 여기에 특정 문제 만 제출하는 것은 귀하의 노력입니다. google에서 listviews 사용에 관한 많은 자료와 샘플 코드를 찾을 수 있습니다. – Yahel

+0

네, 그 사실이지만 내가 data.I에 의해 listview 채울 수있는 방법을 알고 새로운 주제를 만들 것입니다. – Adam