android平台搭建学习 03--界面各按钮的设置(天气预报系统)
2013-07-22 08:57
253 查看
package com.example.sec; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.MenuItem; public class ThreeActivity extends Activity { final static int menu_index=Menu.FIRST;//菜单的设置定义 final static int menu_content=Menu.FIRST+1; final static int menu_last=Menu.FIRST+2; @Override public boolean onOptionsItemSelected(MenuItem item) { // TODO Auto-generated method stub //return super.onOptionsItemSelected(item); switch(item.getItemId()){ case menu_index: Intent in1=new Intent(ThreeActivity.this,MainActivity.class); startActivity(in1); return true; case menu_content: Intent in2=new Intent(ThreeActivity.this,SecActivity.class); startActivity(in2); return true; case menu_last: return true; } return false; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_three); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. //getMenuInflater().inflate(R.menu.three, menu); menu.add(0, menu_index,0 , "天气预报").setIcon(android.R.drawable.btn_star); menu.add(0, menu_content,1 , "历史数据").setIcon(android.R.drawable.btn_star); menu.add(0, menu_last,2, "系统设置").setIcon(android.R.drawable.btn_star); return true; } }
<TextViewandroid:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="36dp" android:text="城市名称(拼音):" /> <EditText
android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/textView1" android:layout_alignParentRight="true" android:ems="10" android:inputType="textPostalAddress" android:textSize="12sp"
/><TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="30dp" android:text="更新频率:" /> <EditText
android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/textView2" android:layout_marginLeft="16dp" android:layout_toRightOf="@+id/textView2" android:ems="10" android:inputType="number"
android:textSize="12sp" /><TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView2" android:layout_below="@+id/textView2" android:layout_marginTop="18dp" android:text="提供短信服务:"
/> <CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView3" android:layout_alignBottom="@+id/textView3" android:layout_toRightOf="@+id/textView3" android:text="是"
/><TextView android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView3" android:layout_below="@+id/checkBox1" android:layout_marginTop="16dp" android:text="记录短信服务数据信息:" />
<CheckBox android:id="@+id/checkBox2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/textView4" android:layout_alignBottom="@+id/textView4" android:layout_marginLeft="14dp" android:layout_toRightOf="@+id/textView4"
android:text="是" /><TextView android:id="@+id/textView5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView4" android:layout_centerVertical="true" android:text="短信服务关键字:" /> <EditText android:id="@+id/editText3"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/textView5" android:layout_alignLeft="@+id/editText1" android:ems="10" android:textSize="12sp" > <requestFocus /> </EditText> <Button android:id="@+id/button1"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView5" android:layout_alignRight="@+id/editText2" android:layout_below="@+id/textView5" android:layout_marginTop="27dp" android:minWidth="120dp" android:text="应用系统设置"
/> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/button1" android:layout_alignRight="@+id/button1" android:layout_below="@+id/button1" android:layout_marginTop="15dp"
android:minWidth="120dp" android:text="取消系统设置" /></RelativeLayout>
按钮的设置
相关文章推荐
- android 平台搭建学习01--第一个界面的菜单设置及与其他三个界面的相互跳转(天气预报系统)
- android平台搭建学习 02---界面中列表的实现(天气预报系统)
- Android 分享两个你学习android 平台开发必须碰到的几个知识点的组件【天气预报、日期】View 组件 推荐
- Android 编程之天气预报闹钟启动服务设置界面加载--4
- Android 分享两个你学习android 平台开发必须碰到的几个知识点的组件【天气预报、日期】View 组件
- Android 分享两个你学习android 平台开发必须碰到的几个知识点的组件【天气预报、日期】View 组件
- 【Cocos2D-X学习笔记】Mac系统下Android平台环境搭建
- Android系统源代码学习-三击事件的实现(Android设置界面的三击Android版本弹出logo)
- Android客户端之“微服私访”App的系统学习(七)XRecyclerView快速实现列表界面+自定义Search输入框,软键盘搜索按钮监听+TextView部分样式改变
- android学习天气预报系统
- Android中自动跳转到系统设置界面
- 【项目源码】- 【天气预报】模仿魅族系统天气预报android
- Android中自动跳转到系统设置界面
- Android平台下的FFmpeg的学习之路------(二)环境搭建
- 系统深入学习android-Android框架学习-5.设置(Settings)
- android 如何能使界面跳转到系统网络设置界面
- android 开发平台的搭建 学习笔记零开始
- 新浪微博Android客户端学习记录二:系统主框架搭建
- 转 Android中进入系统设置界面
- Android编程学习系列:第一篇,搭建开发平台