我已經定製我自己ListView
,其中包括:Android的轉換從的LinearLayout到CheckedTextView和TextView的
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="5dp">
<CheckedTextView
android:id="@+id/txt_lan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:textSize="25sp" /></LinearLayout>
,我希望能夠展示的是裏面有什麼文字我CheckedTextView
:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getApplicationContext(), (((TextView)CheckedTextView)view).getText().ToString(), Toast.LENGTH_SHORT).show();
因此,我認爲,查看包含對我的LinearLayout
的引用。如何訪問CheckedTextView
中的文字?因爲我的方式似乎並沒有工作