2014-02-11 1 views
0

학교 프로젝트 용 Android 애플리케이션 (API 19)을 제작 중이며 앱 본문 상단이 제목으로 막혀 있습니다. this picture에서 내가하려는 일을 볼 수 있습니다. 제목을 모두 없애는 것도 바람직 할 수 있습니다. (android : theme = "@ android : style/Theme.Black.NoTitleBar"은 효과가없는 것 같습니다.제목이 Android 앱의 기본 애플리케이션 본문과 겹칩니다.

여기 내 코드입니다 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 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:layout_gravity="center" 
    android:background="#707070" 
    android:orientation="vertical" 
    android:theme="@android:style/Theme.Black.NoTitleBar" 
    tools:context=".FullscreenActivity" > 

    <!-- this is here only to display the first line correctly (zero container)--> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:gravity="right" 
     android:layout_height="50dp" > 

      <!--some functionality was necessary to avoid warnings--> 
     <TextClock 
      android:id="@+id/textClock1" 
      android:layout_gravity="right|center_vertical" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/textClock" /> 
    </LinearLayout> 

    <!-- this is the first container --> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="40dp" > 

     <!-- this is the heart rate interval progress bar --> 
     <ProgressBar 
      android:id="@+id/progressBar1" 
      style="?android:attr/progressBarStyleHorizontal" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1.06" /> 

     <!-- this is a blue heart icon --> 
     <ImageButton 
      android:contentDescription="@string/heartIcon" 
      android:id="@+id/imageButton1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/button_heart_blue" /> 
    </LinearLayout> 


    <!-- code omitted --> 


</LinearLayout> 

나는 "솔루션"행복하지 않다 나는 함께했다. 이 기능을 코딩하는 더 깨끗한 방법이 있습니까?

나는 어떤 도움을 주셔서 감사합니다! 고맙습니다!

+0

내 대답을 확인했습니다 – kId

+0

네, 효과가 있습니다! 감사! – GiannisKuopio

답변

0

UR XML 레이아웃에서 해당 속성이 application tag 통해 UR 프로젝트의 manifest 파일

android:theme="@android:style/Theme.Black.NoTitleBar" 

을이 추가 삽입하지 마십시오 이처럼

<application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@android:style/Theme.Black.NoTitleBar" 
     android:largeHeap="true"> 
UR 응용 프로그램을 전체 화면으로 만드는210

또는 u이

<activity android:name="your_activity_name"  android:theme="@android:style/Theme.Black.NoTitleBar"></activity> 

또는 u 자바 코드에서 그것을 할 수

requestWindowFeature(Window.FEATURE_NO_TITLE);//for removing tittle bar 
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//for removing notification bar if u want to remove it 
+0

나는 3 가지 다른 방법을 보여줍니다. 술집 바를 숨길 수 있습니다. 그 중 하나를 사용할 수 있습니다. :) U 앱을 통해 바를 숨기고 싶다면 첫 번째 해결책을 찾으십시오. – kId

+0

작동합니다. 내가 제안한 것처럼 AndroidManifest.xml 파일의'activity' 태그에 코드를 넣었습니다. 제목이 없어졌습니다. 그러나이 솔루션은 특정 .xml이 구성하려고했던 것뿐만 아니라 응용 프로그램의 모든 화면에서 제목을 제거합니다. 다른 해결책이 있을까요? – GiannisKuopio

0

당신은 호출 활동의 코드에서 제목 표시 줄을 제거 할 수 있습니다

activity.requestWindowFeature(Window.FEATURE_NO_TITLE); 
0

조언으로처럼 전체 화면을 보여주고 싶은 활동 activity 태그 kaushik에서 모든 응용 프로그램 창에서 제목을 완전히 제거하려면 AndroidManifest.xml 파일을 다음과 같이 편집해야합니다.

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.myapp" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="18" 
     android:targetSdkVersion="18" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 

     <activity 
      android:name="com.example.myapp.FullscreenActivity" 
      android:configChanges="orientation|keyboardHidden|screenSize" 
      android:label="@string/app_name" 
      android:theme="@android:style/Theme.Black.NoTitleBar" > 
      <!-- android:theme="@style/FullscreenTheme" --> 
      <!-- this was replaced in order to get rid of the title --> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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

</manifest> 
관련 문제