Android UI Listview

1.  list.setAdapter(adapter);

2 adapter 会要求布局关联文件 

     SimpleAdapter adapter = new SimpleAdapter(this, getData(), R.layout.list_item, 

        new String[]{"title","img"}, new int[]{R.id.title,R.id.img});

3.<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

			android:layout_width="fill_parent" 
			android:layout_height="fill_parent"
			android:background="@drawable/selector"
			>
						
	    <ImageView android:id="@+id/img"  
			android:layout_width="wrap_content" 
			android:layout_height="wrap_content"			
			android:layout_gravity="center_vertical"
			android:layout_marginLeft="20dp"			
			/>
			
	<LinearLayout android:orientation="vertical" 
		android:layout_width="fill_parent"  
		android:layout_height="wrap_content">
								
		<TextView android:text="data" android:id="@+id/title"
			android:layout_width="fill_parent" 
			android:layout_height="wrap_content" 
			android:gravity="center_vertical"  
			android:layout_marginLeft="20dp" 
			android:layout_marginTop="20dp" 
			android:textSize="14sp" 						
			android:textStyle="bold"
			android:textColor="@color/black" 						
			>
		</TextView>			
    </LinearLayout>
</LinearLayout>

 

 selector  :

 

 

<selector xmlns:android="http://schemas.android.com/apk/res/android">
	<item android:state_selected="true">
		<shape>
			<gradient android:angle="270" android:endColor="#4559F3"
				android:startColor="#4559F3" />
			<size android:height="60dp" android:width="320dp" />
		</shape>
	</item>
	<item android:state_pressed="true">
		<shape>
			<gradient android:angle="270" android:endColor="#4559F3"
				android:startColor="#1C20C0" />
			<size android:height="60dp" android:width="320dp" />
		</shape>
	</item>
	<item>
		<shape>
			<gradient android:angle="270" android:endColor="#E8EBEE"
				android:startColor="#FEFFFF" />
			<size android:height="60dp" android:width="320dp" />
		</shape>
	</item>
</selector>
 

 

 

byte[]  sss = new byte[24] ;// 

 内部类调用拥有内部类的外部类

 

listAdapter = new MessageListAdapter( MailListActivity.this, mData );

mListView.setAdapter( listAdapter );

mListView.setOnScrollListener(MailListActivity.this );

  dialog.dismiss(); 

 

 

 

listview  选项中包含Button 时候无法触发事件

 外层layout : <android:descendantFocusability="blocksDescendants"

<ImageButton android:id="@+id/batch_flag_button"
	android:focusable="false"
 

 

你可能感兴趣的:(android ui)