@Override    protected void onCreate(Bundle savedInstanceState) {        //必须先调用onCreate()方法的超类的实现方法,然后再调用其它方法,这一点很关键。而在Activity其它的生命周期方法中,是否首先调用超类方法就不那么重要了。        super.onCreate(savedInstanceState);        // 布局命名规则:将activity名称的单词顺序颠倒过来并全部转换为小写字母,让后在单词间添加下划线        setContentView(R.layout.activity_quiz);        mTrueButton = (Button) findViewById(R.id.true_button);        mFalseButton = (Button) findViewById(R.id.false_button);        //类包组织倒入的快捷键:1、Command+shift+O(Mac系统);2、Ctrl+Shift+O(Windows系统和Linux系统)        mTrueButton.setOnClickListener(new OnClickListener() {            @Override            public void onClick(View v) {                Toast.makeText(QuizActivity.this, R.string.correct_toast, Toast.LENGTH_SHORT).show();            }        });        mFalseButton.setOnClickListener(new OnClickListener() {            @Override            public void onClick(View v) {                Toast.makeText(QuizActivity.this, R.string.incorrect_toast, Toast.LENGTH_SHORT).show();            }        });    }
<!-- LinearLayout虽然是根源素,但它也有父视图(View),android提供该父视图来容纳应用的整个视图层级结构 --><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" />
<string name="app_name">GeoQuiz</string><string name="menu_settings">Settings</string><!-- 项目已默认配置好应用菜单,请勿删除menu_settings字符串设置,否则将导致与应用菜单相关的其他文件发生版式错误 -->
 <Button  android:id="@+id/next_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/next_button" android:drawableRight="@drawable/arrow_right" android:drawablePadding="4dp"/>      <!-- 加粗字体所描述的button的属性drawableRight与drawablePadding我似乎从未用过,但使用很方便 -->      <!-- 任何添加到res/drawable目录中,后缀名为.png、.jpg和.gif的文件都会被自动赋予资源ID,但文件名必须是小写字母且不能有任何空格符号。 -->

更多相关文章

  1. 【Android(安卓)开发教程】LinearLayout线性布局
  2. 【Android】项目常用功能集锦(一)
  3. android实现倒计时功能的方法
  4. Android获取手机SIM卡运营商信息的方法
  5. Android异步更新UI的方式之使用Handler的post(Runnabel r)方法
  6. AppCompat中的坑
  7. Android(安卓)数据加密方法 AES DES RSA AndroidKeyStore
  8. H5 调用android原生相机代码分析
  9. 菜鸟Android(1)

随机推荐

  1. Android Google App
  2. android 蓝牙各种UUID
  3. 3、android颜色取值
  4. Android添加横线和竖线分割界面
  5. Android开机分析
  6. Android官方资料--Adoptable Storage
  7. android dialog style属性设置
  8. 关于android的monkey测试
  9. Android Pid和Uid
  10. Android(安卓)ANR