随笔分类 -  Android

ANDROID解决屏幕旋转而导致重启ACTIVITY
摘要:原文转自:http://www.sunnyu.com/?p=223在 ANDROID 程序中禁止屏幕旋转和避免重启ACTIVITY禁止屏幕随手机旋转变化有时候我们希望让一个程序的界面始终保持在一个方向,不随手机方向旋转而变化:在AndroidManifest.xml的每一个需要禁止转向的Activity配置中加入android:screenOrientation=”landscape”属性。landscape = 横向portrait = 纵向避免在转屏时重启ACTIVITYandroid中每次屏幕方向切换时都会重启Activity,所以应该在Activity销毁前保存当前活动的状态,在Act 阅读全文

posted @ 2012-04-27 16:32 FengMichael 阅读(643) 评论(0) 推荐(0)

Android_Menu Demo
摘要:Eclipse Version:Galieo-SR2-win32ADT Version:14.0.0SDK Version :1.5JDK Version:Sun 1.6.0_26效果图:AndroidManifest.xml:<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.travis" 阅读全文

posted @ 2011-11-05 11:31 FengMichael 阅读(154) 评论(0) 推荐(0)

Android_文档学习_Building Custom Components
摘要:Building Custom ComponentsAndroid提供了一套精巧的强大的组件化的模型供你创建你的UI,它们是基于layout的View和ViewGroup的类.这个平台提供了许许多多的已经建好的View和ViewGroup子类-被称为widgets 和 layouts,正如所预期的那样.你可以用这些构造你自己的UI.一部分可用的widgets包括 Button, TextView, EditText, ListView,CheckBox, RadioButton, Gallery, Spinner,和更多特殊用途的widgets: AutoCompleteTextView, I 阅读全文

posted @ 2010-12-15 20:50 FengMichael 阅读(125) 评论(0) 推荐(0)

Android_文档学习_UI_Applying Styles and Themes
摘要:Applying Styles and Themes一种Style就是许多具体样子和View或者window的的格式属性的集合.一种Style可以具体化高度,间距,字体颜色,字体大小,背景色,还有其他多种属性.一种Style在一个和布局xml文件分开的xml源文件中被定义.Android中的Style类似用来覆盖在网页设计中的样式表-它们允许你将内容和设计分开来.例如用如下style将如下xml文件:<TextView android:layout_width="fill_parent" android:layout_height="wrap_content 阅读全文

posted @ 2010-12-15 11:40 FengMichael 阅读(143) 评论(0) 推荐(0)

Android_文档学习_UI_Notifying the User
摘要:Notifying the User本文测试代码csdn下载频道:http://download.csdn.net/source/2907960通知用户的方式包括3种.一种是Toast一种是Status Bar(状态栏),还有一种是前面已经提到过的Dialog(对话框).具体的我就不介绍了,因为网上也介绍的比较清楚.我就把怎么用的,然后使用过程中,需要注意到的一些写一下.这样读者读起来就比较轻松了.1.Creating Toast Notifications首先,要具体化一个Toast对象用makeText()方法.这个方法需要3个参数.包括应用程序的Context,text message, 阅读全文

posted @ 2010-12-14 11:07 FengMichael 阅读(155) 评论(0) 推荐(0)

Android_文档学习_UI_Handling UI Events
摘要:Handling UI Events在android中,有多种拦截用户与你的应用程序之间交互的方式.当考虑到你的用户接口事件,倾向是捕捉从具体的与用户交互的View对象中产生的Event.view类提 供了这些方法让你这样做.随着,这么多的你可能用于组成你的布局的view 类,你可能注意到若干公共的看起来对用户接口事件有用的回调方法.这些方法当预期的action发生的发该对象上时,被称作android 的framework(框架).举例来说,当一个View(例如一个Button)被按下时,onTouchEvent()就被该对象调用.然而,为了拦截这个action,你必须扩展这个类,然后重写这个 阅读全文

posted @ 2010-12-13 14:41 FengMichael 阅读(142) 评论(0) 推荐(0)

Android_文档学习_UI_Creating Dialogs
摘要:Creating DialogsAndroid中的Dialog,(既对话框). 包括1)AlertDialog 2)ProgressDialog 3)DatePickerDialog 4)TimePickerDialog 5)Custom Dialog本文测试代码csdn下载频道:http://download.csdn.net/source/2903639我发现要将文档理顺,其实最好就是全文翻译,但我不想这么做,我就把大致的理一下.方便自己和别人以后查阅使用.AlertDialogA dialog that can manage zero, one, two, or three button 阅读全文

posted @ 2010-12-12 17:59 FengMichael 阅读(174) 评论(0) 推荐(0)

Android_文档学习_UI_creating menus
摘要:Creating Menusandroid 菜单包括三种.Options Menu, Context Menu 和Submenu.本文完整代码CSDN下载频道:http://download.csdn.net/source/2900952 ,1.Options Menu(选项菜单)@方法1 需要重写public boolean onCreateOptionsMenu(Menu menu)和public boolean onOptionsItemSelected(MenuItem item)方法,可用如下代码,添加menuitem@Override public boolean onOptio. 阅读全文

posted @ 2010-12-11 15:51 FengMichael 阅读(150) 评论(0) 推荐(0)

导航