Der text der TextView von Element ListView

Ich möchte den text einer TextView, die in einem ListView Element.

Finden Sie den code, und Sie werden finden, was meine Frage.

Activity.java:

SimpleAdapter adapter = new SimpleAdapter(
                rootView.getContext(),
                result,
                R.layout.article_list_item,
                new String[]{"article_title", "article_PubDate", "article_category", "article_articleNo"},
                new int[]{R.id.article_title, R.id.article_PubDate, R.id.article_category, R.id.article_articleNo});
ListView articleItem.setAdapter(adapter);
articleItem.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                //I want get the text of R.id.article_articleNo(see article_list_item.xml)?
                //What should I do?
            }
});

article_list_item.xml :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/article">

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="文章标题"
    android:id="@+id/article_title"
    android:layout_gravity="center_horizontal" />

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="30-Apr-2014"
        android:id="@+id/article_PubDate"
        android:layout_gravity="center_horizontal"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="personal_finance"
        android:id="@+id/article_category"
        android:layout_gravity="center_horizontal"
        android:layout_marginLeft="20dp"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="9312"
        android:id="@+id/article_articleNo"
        android:layout_gravity="center_horizontal"
        android:layout_marginLeft="20dp"/>
</LinearLayout>

</LinearLayout>

!!

Ich will den text von R. id.article_article (siehe article_list_item.xml).

Wie kann ich es tun?

InformationsquelleAutor zhiwen zhang | 2014-11-05

Schreibe einen Kommentar