androidandroid-layoutandroid-studiotoolbarandroid-titlebar

Android Studio Navigation bar showing Apps's name is missing?


When I launch the apps in Emulator, I realize the Navigation bar which shows apps name is missing. May I know what's going on?

public class MainActivity extends Activity implements OnClickListener {

EditText first_name;
EditText last_name;
Button button_submit;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    first_name = (EditText) findViewById(R.id.first_name);
    last_name = (EditText) findViewById(R.id.last_name);
    button_submit = (Button) findViewById(R.id.button_submit);
    button_submit.setOnClickListener(this);

}
@Override
public void onClick(View v) {
    Intent intent = new Intent(this, ViewActivity.class);
    intent.putExtra("first_name", first_name.getText().toString());
    intent.putExtra("last_name", last_name.getText().toString());
    startActivity(intent);
  }
}

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yuqk.intent_usage">

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".ViewActivity"></activity>
</application>

Style.xml

<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

Please refer the the screenshot for reference.. Thanks!

screenshot


Solution

  • Probably you have

     android:theme="@style/AppTheme.NoActionBar" 
    

    in your AndroidManifest.xml. If so, you need to change it to

      android:theme="@style/AppTheme"
    

    (assuming you have AppTheme defined in styles.xml with parent parent="Theme.AppCompat.Light.DarkActionBar" or similar).