欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

圓角背景的ListView

系統 2028 0

先定義一張圓角的圖片shape_bg_listview.xml
    
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
       android:shape="rectangle"
       >
       <gradient  
       android:startColor="@android:color/white"  
       android:endColor="#FFCCCCCC"  
       android:angle="180" 
       />
       <stroke android:width="0px" 
       android:color="@android:color/white" 
       /> 
       <solid android:color="@android:color/white" 
       /> 
       <corners 
       android:bottomRightRadius="20px" 
       android:bottomLeftRadius="20px" 
       android:topLeftRadius="20px" 
       android:topRightRadius="20px" 
       />
</shape> 

  

然后在ListView中引用它,注意android:listSelector為了去掉選中效果:
    
<ListView android:id="@+id/list" 
		android:layout_width="fill_parent" 
		android:layout_height="wrap_content"
		android:layout_margin="20.0dip"
		android:cacheColorHint="@null" 
                android:listSelector="@drawable/shape_bg_listview"
		android:background="@drawable/shape_bg_listview"
		/>

  

代碼:
    
public class App extends Activity {
	private ListView mListView = null;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ArrayList<String> list =new ArrayList<String>();
        list.add("1");
        list.add("2");
        list.add("3");
        mListView =  (ListView)findViewById(R.id.list);
        mListView.setAdapter(new AppAdapter(this,list));
    }
    
    class AppAdapter extends BaseAdapter{

    	Context context;
    	ArrayList<String> list;
    	AppAdapter(Context context,ArrayList<String> list){
    		this.context=context;
    		this.list=list;
    	}
		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return list.size();
		}

		@Override
		public Object getItem(int position) {
			// TODO Auto-generated method stub
			return list.get(position);
		}

		@Override
		public long getItemId(int position) {
			// TODO Auto-generated method stub
			return position;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			TextView tv;
			if(convertView==null){
				convertView=LayoutInflater.from(context).inflate(R.layout.simple_item_2, null);
			}
			tv=(TextView)convertView.findViewById(R.id.name);
			tv.setText(list.get(position));
			return convertView;
		}
    	
    }
}

  


simple_item_2.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="wrap_content"
	>
	<TextView
		android:id="@+id/name"
		android:textSize="17.0sp"
		android:textColor="@android:color/black"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_marginLeft="20.0dip"
		android:layout_alignParentLeft="true"
		android:layout_centerVertical="true"
		>
	</TextView>
	<ImageView
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_marginRight="20.0dip"
		android:src="@drawable/arrow"
		android:layout_alignParentRight="true"
		android:layout_centerVertical="true"
		>
	</ImageView>
</RelativeLayout>

  


App列表之圓角ListView(續)
http://www.cnblogs.com/qianxudetianxia/archive/2011/12/11/2283794.html

圓角背景的ListView


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 国产成人精品一区二区三区电影 | 国产亚洲精品久久久久久国模美 | 久久草网站 | 久久精品一区二区三区不卡牛牛 | 亚洲色图欧美色 | 青青草91视频 | 久久精品二区 | 奇米影视图片 | 国产精品www视频免费看 | 国产无遮挡裸体免费视频 | 亚洲精品一区二区三区蜜桃久 | 日韩亚洲第一页 | 五月激情婷婷六月 | 天天色综合影视 | 国产成人一区二区三区 | 色噜噜狠狠大色综合 | 国内色综合精品视频在线 | 国产成人精品视频免费 | 奇米影视小说 | 午夜在线精品偷拍 | 成熟自由日本语热亚洲人 | 国产精品99久久久久久动医院 | 在线视频国产一区 | 色屁屁www影院免费观看软件 | 久草福利在线 | 久草国产在线观看 | 少妇特黄a一区二区三区88av | 成人免费一区二区三区视频网站 | 久久一日本道色综合久久 | 99久久精品国产片 | 99这里只有精品视频 | 日本高清视频在线三级 | 黄视频免费在线观看 | 羞羞的网址 | 亚洲黄色网址 | 精品一区二区三区四区 | 中文字幕日韩欧美 | 亚洲成人激情av | 欧美一区二区黄色片 | 99在线精品免费视频九九视 | 日本高清视频不卡 |