1 回答

TA貢獻2003條經驗 獲得超2個贊
好的,所以要實現這一點,您首先需要創建 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">
<TextView
android:id="@+id/name_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
現在在函數中的適配器中,getView()您需要對其進行充氣并綁定TextView:
convertView = LayoutInflater.from(context).
inflate(R.layout.layout_list_view_row_items, parent, false);
TextView nameTextView = (TextView) convertView.findViewById(R.id.name_text_view);
//and now get the SpinnerArrayObject by position
SpinnerArrayObject currentObject = spinnerArrayObjects.get(position);
nameTextView.setText(currentObject.getName());
return convertView;
添加回答
舉報