list.java

=======================================

public class List extends Activity{

 ListView MyList;
 ArrayList <MyItem> arItem; //이미지, 데이터 이름 저장
 MyListAdapter MyAdapter;
 
 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.listview);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  
  MyList = (ListView)findViewById(R.id.list);
  
  arItem = new ArrayList<MyItem>();
  
  arItem.add(new MyItem(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher),"testing"));
  arItem.add(new MyItem(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher),"testing2"));
  
  MyAdapter = new MyListAdapter(this, R.drawable.icontext, arItem);
  MyList.setAdapter(MyAdapter); //adapter를 세팅하여 화면에 뿌려준다
 }


}

//리스트뷰에 출력할 항목
class MyItem{
 //Icon -> thum   Name -> Date
 MyItem(Bitmap aImg, String aName){
  Img = aImg;
  Name = aName;
 }
 Bitmap Img;
 String Name;
}

//어댑터 클래스
class MyListAdapter extends BaseAdapter{
 Context context;
 LayoutInflater Inflater;
 ArrayList<MyItem> myItemArr;
 int layoutId;
 
 public MyListAdapter(Context _context, int _layoutId, ArrayList<MyItem> _myItemArr){
  context = _context;
  Inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  myItemArr = _myItemArr;
  layoutId = _layoutId;
 }

 @Override
 public int getCount() {
  return myItemArr.size();
 }

 @Override
 public Object getItem(int position) {
  return myItemArr.get(position).Name;
 }

 @Override
 public long getItemId(int position) {
  return position;
 }
 
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
  if (convertView == null){
   convertView = Inflater.inflate(R.layout.listview, parent, false);
  }
  
  ImageView img = (ImageView)convertView.findViewById(R.id.img);
  TextView txt = (TextView)convertView.findViewById(R.id.text);
  
  img.setImageBitmap(myItemArr.get(position).Img); //썸네일 이미지 보여주는 곳
  txt.setText(myItemArr.get(position).Name); //리스트 뷰에 영상 날짜 보여주는 곳
   
  return convertView;
 }
 
}

==============================

listview.xml

================================

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@drawable/back"
    android:orientation="vertical" >
<ListView 
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</ListView>

</RelativeLayout>

 

=============================

icontext.xml

=============================

 

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="60dip"
    android:orientation="vertical"
    android:padding="5dip">
   
    <ImageView
        android:id="@+id/img"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"/>
   
    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#00ff00"
        android:textSize="26sp"
        android:layout_centerVertical="true"
        android:layout_toRightOf="@+id/img"/>

</RelativeLayout>

 

 

 

 

 

도대체 뭐가 문제인지 모르겠어요 ㅠ_ㅠ

왕초보라서 지금 해결을 못하고 있습니다 도와주세요 ㅠ