欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Android學(xué)習(xí)筆記-常用控件

單選按鈕 Radio

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對這個行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價值的長期合作伙伴,公司提供的服務(wù)項目有:域名注冊、網(wǎng)絡(luò)空間、營銷軟件、網(wǎng)站建設(shè)、太平網(wǎng)站維護(hù)、網(wǎng)站推廣。

Android學(xué)習(xí)筆記-常用控件

        <RadioGroup 
            android:id="@+id/genderGroup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <RadioButton 
                android:id="@+id/femaleButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/female"/>
            
            <RadioButton 
                android:id="@+id/maleButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/male"/>
        </RadioGroup>
		genderGroup = (RadioGroup) findViewById(R.id.genderGroup);
		maleButton = (RadioButton) findViewById(R.id.maleButton);
		femaleButton = (RadioButton) findViewById(R.id.femaleButton);
		//...
		genderGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

					@Override
					public void onCheckedChanged(RadioGroup group, int checkedId) {
						// TODO Auto-generated method stub
						if (femaleButton.getId() == checkedId) {
							System.out.println("female");
							Toast.makeText(MainActivity.this, "female",
									Toast.LENGTH_SHORT).show();
						} else if (maleButton.getId() == checkedId) {
							System.out.println("female");
							Toast.makeText(MainActivity.this, "male",
									Toast.LENGTH_SHORT).show();
						}
					}
				});


多選 CheckBox

Android學(xué)習(xí)筆記-常用控件

        <CheckBox 
            android:id="@+id/swim"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/genderGroup"
            android:text="@string/swim"/>
        
        <CheckBox 
            android:id="@+id/read"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/swim"
            android:text="@string/read"/>
        
        <CheckBox 
            android:id="@+id/run"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/read"
            android:text="@string/run"/>
		swimBox = (CheckBox) findViewById(R.id.swim);
		runBox = (CheckBox) findViewById(R.id.run);
		readBox = (CheckBox) findViewById(R.id.read);
		//...
				swimBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton buttonView,
					boolean isChecked) {
				// TODO Auto-generated method stub
				if (isChecked) {
					System.out.println("Swim is checked");
				} else {
					System.out.println("Swim is unchecked");
				}
			}
		});

		readBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton buttonView,
					boolean isChecked) {
				// TODO Auto-generated method stub
				if (isChecked) {
					System.out.println("Read is checked");
				} else {
					System.out.println("Read is unchecked");
				}
			}
		});

		runBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton buttonView,
					boolean isChecked) {
				// TODO Auto-generated method stub
				if (isChecked) {
					System.out.println("Run is checked");
				} else {
					System.out.println("Run is unchecked");
				}
			}
		});
	}


進(jìn)度條 ProgressBar

Android學(xué)習(xí)筆記-常用控件

<ProgressBar 
    android:id="@+id/firstBar"
    
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:visibility="gone"/>

<ProgressBar 
    android:id="@+id/secondBar"
    
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:layout_below="@id/firstBar"
    android:visibility="gone"/>

<Button android:id="@+id/myButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/secondBar"
    android:text="開始"/>
public class MainActivity extends ActionBarActivity {

	private ProgressBar firstBar = null;
	private ProgressBar secondBar = null;
	private Button myButon = null;
	private int i = 0;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		firstBar = (ProgressBar) findViewById(R.id.firstBar);
		secondBar = (ProgressBar) findViewById(R.id.secondBar);
		myButon = (Button) findViewById(R.id.myButton);
		
		myButon.setOnClickListener(new ButtonListener());
	}
	
	class ButtonListener implements OnClickListener{
		
		@Override
		public void onClick(View v) {
			if (i == 0) {
				firstBar.setVisibility(View.VISIBLE);
				secondBar.setVisibility(View.VISIBLE);
			}else if (i < firstBar.getMax()) {
				//設(shè)置朱進(jìn)度條的值
				firstBar.setProgress(i);
				//設(shè)置第二進(jìn)度條的值
				secondBar.setSecondaryProgress(i + 10);
				//默認(rèn)的進(jìn)度條無法顯示進(jìn)行的狀態(tài)
				//secondBar.setProgress(i);
			}else {
				firstBar.setVisibility(View.GONE);
				secondBar.setVisibility(View.GONE);
			}
			i = i + 10;
		}
	}

}


列表 ListView

Android學(xué)習(xí)筆記-常用控件

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    
    <LinearLayout 
        android:id="@+id/ListLinearLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        
        <ListView android:id="@+id/android:list"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:drawSelectorOnTop="false"
            android:scrollbars="vertical"/>
    </LinearLayout>
</LinearLayout>

user.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    <TextView 
        android:id="@+id/user_name"
        android:layout_width="180dip"
        android:layout_height="30dip"
        android:textSize="10pt"
        android:singleLine="true"/>
   <TextView 
        android:id="@+id/user_ip"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:textSize="10pt"
        android:gravity="right"/> 

</LinearLayout>

MainActivity.java

public class MainActivity extends ListActivity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String,String>>();
		HashMap<String, String> map1 = new HashMap<String, String>();
		HashMap<String, String> map2 = new HashMap<String, String>();
		HashMap<String, String> map3 = new HashMap<String, String>();
		
		map1.put("user_name", "admin1");
		map1.put("user_ip", "192.168.24.214");
		
		map2.put("user_name", "admin2");
		map2.put("user_ip", "192.168.24.215");
		
		map3.put("user_name", "admin3");
		map3.put("user_ip", "192.168.24.216");
		
		list.add(map1);
		list.add(map2);
		list.add(map3);
		
		SimpleAdapter listAdapter = new SimpleAdapter(this, list, R.layout.user, new String[]{"user_name", "user_ip"}, new int[]{R.id.user_ip, R.id.user_name});
		setListAdapter(listAdapter);
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		// TODO Auto-generated method stub
		super.onListItemClick(l, v, position, id);
		System.out.println("id:" + id);
		System.out.println("position:" + position);
	}
	
}

本文標(biāo)題:Android學(xué)習(xí)筆記-常用控件
文章URL:http://chinadenli.net/article6/ppsiig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、網(wǎng)站維護(hù)、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站改版App設(shè)計、網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名
中文久久乱码一区二区| 色丁香之五月婷婷开心| 欧美日韩视频中文字幕| 日韩中文无线码在线视频| 国产传媒欧美日韩成人精品| 日韩一区中文免费视频| 小黄片大全欧美一区二区| 大香蕉网国产在线观看av| 日韩精品综合福利在线观看| 福利视频一区二区三区| 日韩一区二区三区久久| 亚洲综合精品天堂夜夜| 一区二区免费视频中文乱码国产| 国产亚洲精品俞拍视频福利区| 欧美日韩三区在线观看| 亚洲视频一区自拍偷拍另类| 麻豆tv传媒在线观看| 亚洲一区二区三区日韩91| 国产av乱了乱了一区二区三区 | 婷婷色香五月综合激激情| 国产日韩精品欧美综合区| 男女一进一出午夜视频| 黄色国产自拍在线观看| 最新国产欧美精品91| 日韩在线中文字幕不卡| 91人妻人人精品人人爽| 国产一区二区在线免费| 日韩一区二区三区在线日| 一区二区三区18禁看| 日韩欧美一区二区亚洲| 91日韩欧美国产视频| 美女露小粉嫩91精品久久久| 久久99一本色道亚洲精品| 在线观看视频成人午夜| 日韩精品综合福利在线观看| 日韩1区二区三区麻豆| 国产午夜精品久久福利| 午夜福利直播在线视频| 欧美成人高清在线播放| 亚洲欧洲一区二区综合精品| 欧美日韩国产福利在线观看|