0
제목이 실제로 말한 것처럼 .. 나는 3 개의 텍스트보기가있는 목록보기가 있습니다. 아래를 참조하십시오.사용자 지정 ListView에서 텍스트 가져 오기
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="20dp" >
<TextView
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#000"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="italic"
android:typeface="sans" />
</LinearLayout>
이렇게하는 방법입니다.
public void displayResultList(ArrayList<HashMap<String, String>> results2) {
// TODO Auto-generated method stub
lv = (ListView) findViewById(android.R.id.list);
SimpleAdapter adapter = new SimpleAdapter(this, results2,
R.layout.custom_row_view,
new String[] { "Ear", "Breed", "Sex" }, new int[] { R.id.text1,
R.id.text2, R.id.text3 });
lv.setAdapter(adapter);
}
이 내가 텍스트를 검색하려고 노력하지만, 문제가 해결되지 않는 방법입니다 ..
나는 텍스트의 첫 번째 라인을 얻을 수있는 방법protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String item = (String) ((TextView) v).getText();
Toast toast3 = Toast.makeText(this, "items = " + item,
Toast.LENGTH_SHORT);
toast3.show();
// Intent mainIntent3 = new Intent(this,CowDetailsActivity.class);
// mainIntent3.putExtra("cow", item.substring(10, 16));
// startActivity(mainIntent3);
}
아무도 말해 줄래? 사전에
감사
완벽한 답변 감사합니다. –