/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.test;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int action_settings=0x7f080004;
public static final int myButton=0x7f080003;
public static final int myCheckBox=0x7f080002;
public static final int myTextView1=0x7f080000;
public static final int myTextView2=0x7f080001;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int main=0x7f070000;
}
public static final class string {
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050002;
public static final int hello=0x7f050000;
public static final int no=0x7f050006;
public static final int ok=0x7f050005;
public static final int str_agree=0x7f050003;
public static final int str_go=0x7f050004;
/** 绌烘牸閮芥槸鐢═AB閿仛鍖洪殧鐨�
*/
public static final int text1=0x7f050007;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello"></string>
<string name="action_settings"></string>
<string name="app_name"></string>
<string name="str_agree">同意</string>
<string name="str_go">确定</string>
<string name="ok">已经同意了!!</string>
<string name="no">*请选择“同意”继续操作*</string>
<!-- 空格都是用TAB键做区隔的 -->
<string name="text1">尊敬的用户,欢迎您注册成为会员。
您确认本服务协议后,本服务协议即在您和本网站之间产生法律效力。请您务必在注册之前认真阅读全部服务协议内容,如有任何疑问,可向本网站咨询。
无论您事实上是否在注册之前认真阅读了本服务协议,只要您点击协议正本下方的"注册"按钮并按照本网站注册程序成功注册为用户,您的行为仍然表示您同意并签署了本服务协议。
</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/myTextView1"
android:layout_width="185px"
android:layout_height="267px"
android:layout_x="67px"
android:layout_y="53px"
android:text="@string/text1"
/>
<TextView
android:id="@+id/myTextView2"
android:layout_width="100px"
android:layout_height="30px"
android:layout_x="190px"
android:layout_y="325px"
/>
<CheckBox
android:id="@+id/myCheckBox"
android:layout_width="97px"
android:layout_height="wrap_content"
android:text="@string/str_agree"
android:layout_x="99px"
android:layout_y="318px"
/>
<Button
android:id="@+id/myButton"
android:layout_width="85px"
android:layout_height="wrap_content"
android:text="@string/str_go"
android:layout_x="102px"
android:layout_y="363px"
/>
</AbsoluteLayout>
package com.example.test;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
public class MainActivity extends Activity {
/*声明 TextView、CheckBox、Button对象*/
public TextView myTextView1;
public TextView myTextView2;
public CheckBox myCheckBox;
public Button myButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*取得TextView、CheckBox、Button*/
myTextView1 = (TextView) findViewById(R.id.myTextView1);
myTextView2 = (TextView) findViewById(R.id.myTextView2);
myCheckBox = (CheckBox) findViewById(R.id.myCheckBox);
myButton = (Button) findViewById(R.id.myButton);
/*将CheckBox、Button默认为未选择状态*/
myCheckBox.setChecked(false);
myButton.setEnabled(false);
myCheckBox.setOnClickListener(new CheckBox.OnClickListener()
{
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
if(myCheckBox.isChecked())
{
/*设置Button为不能选择对象*/
myButton.setEnabled(true);
myTextView2.setText("");
}
else
{
/*设置Button为可以选择对象*/
myButton.setEnabled(false);
myTextView1.setText(R.string.text1);
/*在TextView2里显示出"请勾选我同意"*/
myTextView2.setText(R.string.no);
}
}
});
myButton.setOnClickListener(new Button.OnClickListener()
{
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
if(myCheckBox.isChecked())
{
myTextView1.setText(R.string.ok);
}else
{
}
}
});
}
}