Tôi đã vấp phải một vấn đề Tôi không thể có được đầu của tôi xung quanh, vì vậy tôi hy vọng có lẽ ai đó ở đây đã có cùng một vấn đề hoặc biết cách giải quyết vấn đề .Sử dụng bộ điều hợp mảng có nhiều lượt xem hơn trong hàng trong listview
Tôi đã tạo chế độ xem có chứa một ListView. ListView này chứa hai TextView. Vấn đề là tôi không biết nơi tôi gửi các giá trị có nghĩa là để đi trong xem văn bản thứ hai bằng cách sử dụng ArrayAdapter. Có cách nào để gửi thêm thông tin cho ArrayAdapter để tôi có thể nạp TextView "todaysmenu" không?
Phương pháp ArrayAdapter:
private void createList() {
ListView lv = (ListView) findViewById(R.id.mylist);
String[] values = new String[] { "Android", "Linux", "OSX",
"WebOS", "Windows7", "Ubuntu", "OS/2"
};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.rowlayout, R.id.restaurantname, values);
lv.setAdapter(adapter);
}
Các đánh dấu hàng:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/restaurantname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@+id/restaurantname"
android:textSize="23dp" >
</TextView>
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@+id/todaysmenu" />
</LinearLayout>
Cách bố trí hoạt động:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/mylist"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
Vào đầu tôi có tất cả mọi thứ để làm việc, nhưng khi tôi thêm các vấn đề textfield thứ hai khơi dậy. Trước, cảm ơn sự giúp đỡ của bạn!
Cảm ơn bạn. Điều đó đã giúp! Cảm ơn bạn. – olovholm