我正在尝试将操作栏中的三个点菜单复制到我的其他页面/活动中。在我的应用程序中,我使用按钮导航到下一个屏幕。我复制了代码:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
但是下一个屏幕中什么也没有显示。我也尝试添加项目,标准它只有“设置”,但这也不起作用。我导入了 view.menu。带有我的 appIcon 的操作栏本身确实显示。在上面的代码中使用的“菜单”文件夹中创建一个新的 xml 不起作用。
显现:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ql"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="com.example.ql.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.example.ql.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-library android:name="com.google.android.maps" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCPlVHMostdkcJrs5YvkCXxHQaR94LrxEc"/>
<activity
android:name="com.example.ql.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.ql.ContactActivity" >
</activity>
<activity
android:name="com.example.ql.MediaActivity" >
</activity>
<activity
android:name="com.example.ql.CommunityActivity" >
</activity>
<activity
android:name="com.example.ql.PersoonlijkActivity" >
</activity>
<activity
android:name="com.example.ql.NieuwsActivity" >
</activity>
<activity
android:name="com.example.ql.PortalActivity" >
</activity>
<activity
android:name="com.example.ql.StreamActivity" >
</activity>
<activity
android:name="com.example.ql.GpsActivity" >
</activity>
</application>
</manifest>
样式.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>