Program Tip

Android Studio에서 제목 표시 줄을 제거하려면 어떻게합니까?

programtip 2020. 11. 12. 20:08
반응형

Android Studio에서 제목 표시 줄을 제거하려면 어떻게합니까?


내 앱에는 오버플로 메뉴가있는 상단에이 제목 표시 줄이 있지만 설정이 필요없고 화면이 하나뿐입니다. 다른 많은 질문에 설명 된대로 테마를 변경하면 이전 2.2 테마가 표시됩니다. 나는 맨 위에 바없이 현대적인 테마를 갖고 싶다.


styles.xml과 변화로 이동 .DarkActionBar에 대한.NoActionBar

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
</style>

된다

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
</style>

색상이 앱과 관련이없는 경우 실제로

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" />

매니페스트 파일에서 변경 :

    android:theme="@style/AppTheme" >
    android:theme="@style/Theme.AppCompat.NoActionBar"

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

onCreate()전에 넣어 질 때 작동합니다 setContentView().

그렇지 않으면 충돌


에서 styles.xml의 파일 변경 DarkActionBar을NoActionBar

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>


이것을 확인하십시오

 ActionBar actionBar = getSupportActionBar();
    actionBar.hide();

매니페스트 파일에서 다음과 같이 변경하십시오.

android:theme="@style/Theme.AppCompat.Light.NoActionBar" >

이것은 values/styles.xml항목 추가 에서 나를 위해 일했습니다 .

       `<item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>`

이것은 나를 위해 작동합니다

getSupportActionBar().hide();

  1. styles.xml 열기
  2. 끼워 넣다
 <style name="no_title" parent="AppTheme">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowContentOverlay">@null</item>
 </style>

name = "---------"을 변경할 수 있습니다.

  1. Androidmaifest.xm을 엽니 다.

    find android : theme = "@ style / AppTheme"chang to android : theme = "@ style / no_title"

  2. 메뉴 모음에서 테마 선택을 클릭합니다 (MainActivity 근처에 녹색).

    • 클릭 프로젝트 테마
    • no_title (오른쪽 측면)을 클릭하십시오.
    • 확인을 클릭하십시오

activity_main.xml에서 다음을 삭제하십시오.

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay"/>

더 많은 도움이 필요하면 저에게 연락하십시오


매니페스트 파일에서 다음을 수행하십시오.

<application 
    android:icon="@drawable/icon" 
    android:label="@string/app_name" 
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

this.requestWindowFeature (Window.FEATURE_NO_TITLE);

onCreate ()에서 작동합니다!


이것은 나에게도 효과가 있습니다.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);
}

가장 좋은 방법은 setTitle()로고를 표시하거나 actionBar에 다른 항목이 있지만 앱 이름을보고 싶지 않은 경우이 코드를 MainActivity.java 또는 제목을 숨기려는 위치에 작성하는 경우 작업 표시 줄 기능을 사용하는 것입니다 onCreate.

android.support.v7.app.ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(R.mipmap.full_white_logo_m); // display logo
actionBar.setTitle(""); // hide title

이렇게하면 앱이 충돌 할 이유가 없습니다.


setTitle(null)위의 사용

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

The title will disappear then you can use the logo of your choice.....


The easiest way: Just double click on this button and choose "NoTitleBar" ;)

Click here to see where it is :)


Try changing styles to NoActionBar if that doesn't works add this code to your main activity

 protected void onCreate(Bundle savedInstanceState) {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        ActionBar actionBar = getSupportActionBar();
        actionBar.hide();
        setContentView(R.layout.activity_main);

    }

For Beginner Like Me. Just Do it what I say.From your Android Project.

app -> res -> values -> style.xml

replace this code

<resources>

<!-- Base application theme. -->
<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>
</style>

</resources>

Enjoy.


In AndroidManifest.xml of your application you'll find the android:theme for example set to @style/AppTheme

Now go to styles.xml, find the style tag, make sure that name is set to AppTheme the same as in manifest and set parent to android:Theme.Holo.Light.NoActionBar (also do this in styles(v21) if you have it in your project)

<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar">
    <!-- ... -->
</style>

Just call setTitle(null); in onCreate()


try: toolbar.setTitle(" ");

@Override
protected void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setTitle("");
    setSupportActionBar(toolbar);
}

참고URL : https://stackoverflow.com/questions/26492522/how-do-i-remove-the-title-bar-in-android-studio

반응형