عدم نمایش list view
سلام
من پروژه Listview را طبق آموزش انجام دادم ولی وقتی اجرا میکنم listview را نشان نمیدهد و فقط یک text که بالای پنجره main بوده است نشان میدهد
public class ActivityMain extends Activity {
public ArrayList<StructNote> notes = new ArrayList<StructNote>();
public ArrayAdapter adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView lstContent = (ListView) findViewById(R.id.lstContent);
adapter = new AdapterNote(notes);
lstContent.setAdapter(adapter);
for (int i = 10; i < 10; i++) {
StructNote note = new StructNote();
note.title = "Title " + i;
note.description = "Description " + i;
note.done = false;
notes.add(note);
}
adapter.notifyDataSetChanged();
}
}
------------------- main activity --------------------------------
import java.util.ArrayList;import android.app.Activity;import android.os.Bundle;import android.widget.ArrayAdapter;import android.widget.ListView;publicclassActivityMainextendsActivity{publicArrayList<StructNote> notes =newArrayList<StructNote>();publicArrayAdapter adapter;@Overridepublicvoid onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState); setContentView(R.layout.main);ListView lstContent =(ListView) findViewById(R.id.lstContent); adapter =newAdapterNote(notes); lstContent.setAdapter(adapter);for(int i =10; i <10; i++){StructNote note =newStructNote(); note.title ="Title "+ i; note.description ="Description "+ i; note.done=false; notes.add(note);} adapter.notifyDataSetChanged();}}
------------------------------ main.xml ----------------------------------
<?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"><TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello"/><ListView android:id="@+id/lstContent" android:layout_width="match_parent" android:layout_height="wrap_content"><!--Preview: listitem=@layout/adapter_notes --></ListView></LinearLayout>
-------------------------------------------------------------------------------
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .