다양한 문자열 길이가있는 5 개의 열이있는 데이터베이스에서 테이블을 표시하고 싶습니다. 그 중 가장 좋은 방법은 무엇입니까? 감사합니다. 전 진출했습니다. 이전에는 listview로 시도했지만 다양한 문자열 길이는 올바르게 표시되지 않는 행을 보여줍니다. .안드로이드에 데이터베이스 디스플레이
내 layout.xml 코드 :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="4dip"
android:paddingBottom="6dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView android:id="@+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_alignParentRight="true"/>
<TextView android:id="@+id/text5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_alignParentRight="true"/>
<TextView android:id="@+id/text7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_alignParentRight="true"/>
<TextView android:id="@+id/text9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_alignParentRight="true"/>
<TextView
android:id="@+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
</LinearLayout>
자바 코드 :
super.onCreate(savedInstanceState);
setContentView(R.layout.report);
String[] from;
int[] to;
db.open();
ListView lv=(ListView)findViewById(R.id.listView1);
Cursor c = db.getEducationTitle();
while(c. moveToNext())
{
// Cursor c = db.getEducationTitle();
LinearLayout linearlayout=(LinearLayout)findViewById(R.id.Layout1);
TextView edt=(TextView) new TextView(getApplicationContext());
edt.setText(c.getString(c.getColumnIndex("col1"))+" "+c.getString(c.getColumnIndex("col2"))+" "+c.getString(c.getColumnIndex("col3"))+c.getString(c.getColumnIndex("col4"))+" "+c.getString(c.getColumnIndex("col5")));
linearlayout.addView(edt);
}
는 http://stackoverflow.com/questions/4968226/show-data-in-table-view-in-android jaisonDavis..I이 아무것도 표시되지 않습니다 시도 – Ishtiaq