H
haner
Ambitioniertes Mitglied
- 0
Hallo,
ich rufe über das OverflowMenü eine zweite Activity auf, mit der ich nur Text zeige.
Trotzdem möchte ich, dass die gleiche ActionBar wie auf meiner Hauptseite/Startseite angezeiht wird.
Momentan wird in der Activity gar keine ActionBar angezeigt.
Wo muss ich denn ansetzen, bin gerade hilflos und kann im Web keine Hilfe finden.
Im Anhang seht Ihr meine Projektstruktur.
ImpressumActivity.java
strings.xml
impressum.xml
main.xml
AndroidManifest.xml
ich rufe über das OverflowMenü eine zweite Activity auf, mit der ich nur Text zeige.
Trotzdem möchte ich, dass die gleiche ActionBar wie auf meiner Hauptseite/Startseite angezeiht wird.
Momentan wird in der Activity gar keine ActionBar angezeigt.
Wo muss ich denn ansetzen, bin gerade hilflos und kann im Web keine Hilfe finden.
Im Anhang seht Ihr meine Projektstruktur.
ImpressumActivity.java
Code:
package com.project.ta.taschenlampe;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
public class ImpressumActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.impressum);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
strings.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Taschenlampe</string>
<string name="action_impressum">Impressum</string>
<string name="action_hilfe">Hilfe & Feedback</string>
</resources>
impressum.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a3a3a3"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.project.ta.taschenlampe.MainActivity" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="10px"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_marginTop="10px"
android:text="Text Text Text Text Text Text Text Text Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
main.xml
Code:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.project.ta.taschenlampe.MainActivity" >
<item
android:id="@+id/action_impressum"
android:orderInCategory="100"
android:title="@string/action_impressum"
app:showAsAction="never"/>
<item
android:id="@+id/action_hilfe"
android:orderInCategory="100"
android:title="@string/action_hilfe"
app:showAsAction="never"/>
</menu>
AndroidManifest.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.project.ta.taschenlampe"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ImpressumActivity"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>