在manifest.xml文件中指定Activity的父Activity

<application ... ><activity        android:name=" com.example.myfirstapp.MainActivity "        android:label="@string/title_activity_main_message"<intent-filter>           <action android:name="android.intent.action.MAIN" />           <category android:name="android.intent.category.LAUNCHER" />    </intent-filter>    </activity>     <activity        android:name="com.example.myfirstapp.DisplayMessageActivity"        android:label="@string/title_activity_display_message"        android:parentActivityName="com.example.myfirstapp.MainActivity" >        <meta-data            android:name="android.support.PARENT_ACTIVITY"            android:value="com.example.myfirstapp.MainActivity" />    </activity></application>

The android:parentActivityName attribute declares the name of this activity's parent activity within the app's logicalhierarchy. The system uses this value to implement default navigationbehaviors, such asUp navigationon Android 4.1 (API level 16) and higher.

You can provide the same navigation behaviors for older versions of Android by using the SupportLibrary and adding the<meta-data> element as shown here.


更多相关文章

  1. NPM 和webpack 的基础使用
  2. 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
  3. Android利用SQLite制作最简单成语小词典
  4. android获取图片文件头信息
  5. Android创建文件夹及文件并写入数据
  6. Android读写文件示例
  7. 缓存工具类封装
  8. android中使用ant更改包名
  9. android create and remove shortcut

随机推荐

  1. 电脑通过vnc控制android 手机
  2. 【Android 开源系列】之视频处理框架
  3. IntentFilter使用
  4. 一些关于RelativeLayout属性的用法
  5. Android 常用代码集合
  6. Android递归拷贝assets资源到指定目录
  7. Android属性之excludeFromRecents
  8. android NDK学习篇3之two-libs——使用(多
  9. android studio中gradle更新办法
  10. Android SDK 1-23各版本代号和别名