-
imageView概述
查看全部 -
監(jiān)聽(tīng)器查看全部
-
查看全部
-
第2步:XML文件與源碼關(guān)聯(lián)? src-> Main_activity.java
SetContentView 將布局XML文件引入到activity當(dāng)中
第3步:布置,模擬器看效果? demo1(項(xiàng)目名)-> Run As -> android application
查看全部 -
第1步:界面? res->layout->Main_activity.xml
textView一個(gè)屬性
Wrap_content ?包裹實(shí)際文本內(nèi)容
Match_parent ?當(dāng)前控件鋪滿父類容器
Fill_parent? 當(dāng)前控件鋪滿父類容器
查看全部 -
EditText控件的常用屬性
查看全部 -
TextView控件的常用屬性
查看全部 -
Android項(xiàng)目結(jié)構(gòu)介紹
查看全部 -
開(kāi)發(fā)環(huán)境工具
查看全部 -
RadioGroup
<RadioGroup
??????? android:id="@+id/radioGroup1"
??????? android:orientation="vertical"
??????? android:layout_width="wrap_content"
??????? android:layout_height="wrap_content"
??????? android:layout_alignParentLeft="true"
??????? android:layout_alignParentTop="true" >
??????? <RadioButton
??????????? android:id="@+id/radio0"
??????????? android:layout_width="wrap_content"
??????????? android:layout_height="wrap_content"
??????????? android:checked="true"
??????????? android:text="man" />
??????? <RadioButton
??????????? android:id="@+id/radio1"
??????????? android:layout_width="wrap_content"
??????????? android:layout_height="wrap_content"
??????????? android:text="women" />
??? </RadioGroup>package com.example.demo3;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.RadioGroup;
import android.widget.Toast;
public class MainActivity extends Activity implements android.widget.RadioGroup.OnCheckedChangeListener{
?? ?
?? ?private RadioGroup? ra;
?? ?@Override
?? ?protected void onCreate(Bundle savedInstanceState) {
?? ??? ?super.onCreate(savedInstanceState);
?? ??? ?setContentView(R.layout.activity_main);
?? ??? ?
?? ??? ?ra=(RadioGroup) findViewById(R.id.radioGroup1);
?? ??? ?ra.setOnCheckedChangeListener(this);
?? ??? ?
?? ?}
?? ?@Override
?? ?public void onCheckedChanged(RadioGroup group, int checkedId) {
?? ??? ?// TODO 自動(dòng)生成的方法存根
?? ??? ?switch (checkedId) {
?? ??? ?case R.id.radio0:
?? ??? ??? ?Toast.makeText(this, "you are man",Toast.LENGTH_SHORT).show();
?? ??? ??? ?break;
?? ??? ?default:
?? ??? ??? ?Toast.makeText(this, "you are women",Toast.LENGTH_SHORT).show();
?? ??? ??? ?break;
?? ??? ?}
?? ?}
}查看全部 -
<CheckBox
??????? android:id="@+id/checkBox1"
??????? android:layout_width="wrap_content"
??????? android:layout_height="wrap_content"
??????? android:text="籃球" />查看全部 -
?<ToggleButton
??????? android:id="@+id/toggleButton1"
??????? android:layout_width="match_parent"
??????? android:layout_height="wrap_content"
??????? android:textOn="開(kāi)"
??????? android:textOff="關(guān)"
????????? />
??? <ImageView
??????? android:id="@+id/imageView1"
??????? android:layout_width="match_parent"
??????? android:layout_height="match_parent"
??????? android:background="@drawable/off" />private ToggleButton tb;
?? ?private ImageView im;
?? ?@Override
?? ?protected void onCreate(Bundle savedInstanceState) {
?? ??? ?super.onCreate(savedInstanceState);
?? ??? ?setContentView(R.layout.activity_main);
?? ??? ?tb=(ToggleButton) findViewById(R.id.toggleButton1);
?? ??? ?im=(ImageView) findViewById(R.id.imageView1);
?? ??? ?
?? ??? ?tb.setOnCheckedChangeListener(this);
?? ??? ?
?? ?}
?? ?@Override
?? ?public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
?? ??? ?// TODO 自動(dòng)生成的方法存根
?? ??? ?
?? ??? ?im.setBackgroundResource(isChecked?);
?? ?}?? ?查看全部 -
activity的生命周期
查看全部 -
匿名內(nèi)部類監(jiān)聽(tīng)按鈕點(diǎn)擊事件
查看全部 -
Button 和 ImageButton特征
查看全部
舉報(bào)