Android app shortcut name appears everywhere

I use this theme in my android app, Theme.AppCompat.Light.NoActionBar

in every activity the name of my project, that is, the name label

from the tag Application

appears in every android activity before this didn’t happen, but lately this is happening.If I remove the shortcut, the name appears instead of the name package.

What exactly is going on?

I know there are several ways to fix this, but to show where I am going wrong and what is going on? This is mistake?

I mentioned the previous answer Android app name came up as the name of the action and tried but still didn't work, so here is a copy of my manifest.xml

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        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=".Activity2"></activity>
    </application>

      

Below is an example screenshot, the label name can be seen even though this activity (Activity2) consists of a toolbar and the white area is the edittext in the toolbar and there is nothing else in the toolbar.

EDIT 1

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:textColor">@color/white</item>
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:textColorSecondary">@color/white</item>
    </style>

      

EDIT 2

public class Activity2 extends AppCompatActivity {


    LinedEditText editText;
    Toolbar toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity2);


        toolbar = (Toolbar) findViewById(R.id.toolbar);
        editText = (LinedEditText) findViewById(R.id.editText);
        setSupportActionBar(toolbar);


    }
}

      

activity2.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
  >
    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/green"
        android:id="@+id/toolbar"
        >

        <EditText
            android:layout_width="250dp"
            android:layout_height="40dp"
           android:id="@+id/title"
            android:background="@color/white"
            android:layout_margin="10dp"
            />
        </android.support.v7.widget.Toolbar>
    <com.test.testproject.LinedEditText
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:id="@+id/editText"
        android:gravity="top"
        />
</LinearLayout>

      

enter image description here

+3


source to share


4 answers


UPDATE:

It's your problem. Avoid using the toolbar.

<android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/green"
        android:id="@+id/toolbar"
        >

        <EditText
            android:layout_width="250dp"
            android:layout_height="40dp"
           android:id="@+id/title"
            android:background="@color/white"
            android:layout_margin="10dp"
            />
        </android.support.v7.widget.Toolbar>

      



If you are using NoActionBar

in your theme. Avoid using toolbar in activity layout. It is for this reason that you get the title Activity.

If you are using the toolbar, make sure you disable TITLE .

0


source


Check it.



getSupportActionBar().setDisplayShowTitleEnabled(false);

      

0


source


Check with setting theme for specific activity..which solves your problem..try this 
<style name = "NoActionBar" parent = "@android:style/Theme.Holo.Light">
        <item name = "android:windowActionBar">false</item>
        <item name = "android:windowNoTitle">true</item>
    </style>

      

0


source


Just add onCreate () method after setSupportActionBar (toolbar).

    setContentView(R.layout.activity_main);
    ActionBar actionBar = getActionBar();
    actionBar.setTitle("");

      

0


source







All Articles