您好,欢迎光临本网站![请登录][注册会员]  
文件名称: Android类库介绍.pdf
  所属分类: Delphi
  开发工具:
  文件大小: 10mb
  下载次数: 0
  上传时间: 2019-07-13
  提 供 者: chunya*******
 详细说明:Android类库介绍.pdf`Actirity starts oncreate( User navigate back to the actvty nsta arto onStar:o Process is killed reSume Activ ty Is runin The act/w’y ng comes to the 「 Anothe actvity comes I in front of the activiry her applications cornes fa ihe rHeed merry onP Foreground (The activity is n longer visible unstop deStroy! lut down startActivity (Intent intent); start Activity ForResult(Intent intent, int requestCodey onActivityResult(int requestCode, int resultCode, Intent intent); setResult(int result code resultCode RESULT CANCELED, RESULT_OK, or any custom values starting at RESULT- FIRST_USER. If a child activity fails for any reason(such as crashing), the parent activity will receive a result with the code resUjt_canceled Saving Persistent state Activity通常需憂处理两种类型的的持续状态( persistent state):共享文档类型数据(典型的 是使用 Content Provider存储在 SQLite数据厍中)和内部状态(如月户徧好, User perferences) android app. Activity Group extends Activty Direct Subclass: TabActivity A screen that contains and runs multiple embedded activities Android app. ActivityManager extends java. lang Object Interact with the overall activities lunning in the system 这个类包含了许多内部类。 直接子类: Contextmenu, Submenu Menu. FIRST First value for group and item identifier integers MenuItem add(int titleres ); Menuitem add(int groupld, int itemId, int order, CharSequence title) MenuItem add(int groupld, int itemId, int order, int title Res); Menultem add( CharSequence title) public interface android view Menuitem char getAlphabeticShortcuto Int getGroupld(; Drawable getleono int getItemldo int getorder SubMenu getsubMenuo Char Sequence getTitle(: MenuItem setOnMenultemClickListener(Menultem OnMenulteClickListener menultemClickListener public boolean android app. Activity. onOptionsltem Selected(MenuItem item public boolean android app. Activity. on ContextitemSelected(Menultem item Android资源系统 一些术语 asset Resource table Resource Resource identifier Primitive resource:所有原始资源均可用一个简单的字符串表示,包括整数、颜色、字符串 和对其它资源的引用等。复杂的資源,比如位图、ⅹML文件等,被存储为个元素字符串 资源,它的值是潜在资源的路径,这个潜在资源持有实际数据。 Bag resource: 系统预留资源 android.r*sals 字符串资源 hello there, you/i> ActivitvClear resources> /res/values/strings. xml String back= getResources(), getString(R string. back). to String back=get String(R string back).to(; // synonym 颜色资源 /res/values/colors. xml #80ff0000 +OH resources> 校式:"gb","#argb,"# rrggbb",or"# aarrggbb" The alpha channel is Oxff (or0 xf) for opaque(不透明的)and0 for transparent(透明的) translucent, Semitransparent:半透明的 int red= getResourcesO, get Color(R- color opaque_red) Drawable资源 res/drawable/my_badge.pny public void on Start requestScreen Features (FEATURE_ BADGE_ IMAGE super. onStarto setBadgeResource(R drawable. my_badge) For drawables that are a single solid colof, you can also define them in a resource file very much like colors shown previously. The only difference is that here we use the tag to create a drawable resource #ffff0000 #80ff0000 #0000ff#ofO android: drawable/theme_background /resources> 主题属性引用 另一种資源值允许你引用当前主题的属性值,这种类型的属性引用只能用于 style资源和 XML文件中的属性。它允许你根据当前主题的变化来定制U元素的外观,以免提供更多的 具体值 android; textColor=?android: textDisabledColor 样式资源( Style resource) 一个样式资源是一组描述若干相关属性的name/ value对。这类资源有两个主要用途:定义 全局视觉主题和描述一组视觉属性(这些视觉属性用于布局资源中的一个类)。与字符串资 源一样,样式也是通过一个XML资源文件定义。 /res/values/styles.xml