2012-05-11 3 views
0

업데이트내 Hello World Android 활동이 전체 화면에 걸쳐 나타나지 않는 이유는 무엇입니까?

다음 스타일을 추가하고 내 응용 프로그램을 설정 한 후, 나는 그것이 전체 화면 그릴 입수했습니다 : 내 첫 안드로이드 응용 프로그램을 개발하는 동안

<resources> 
    <style name="app_theme" parent="android:Theme.NoTitleBar"> 
     <item name="android:windowBackground">@color/green</item> 
    </style>  
</resources> 

을 나는 내 애플 리케이션 것을 깨달았다 '뷰는 전체 화면으로 확장되지 않으며 다운로드 한 다른 샘플 프로젝트는 그렇지 않습니다. 이를 테스트하기 위해 기본 액티비티 클래스를 만들고 TextView의 배경을 녹색으로 설정하여 얼마나 많은 액티비티가 있는지 확인합니다. 이 말은 어리석은 질문이라면 용서해주십시오. 여기

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 
<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:text="Hello World, StackOverflow" 
    android:background="#00FF00" 
    /> 
</LinearLayout> 

과 : 여기

public class HomeActivity extends Activity 
{ 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
    } 
} 

레이아웃 파일 (/res/layout/main.xml)입니다 : 여기 enter image description here

이 전체 HomeActivity의 자료 : 여기

는 스크린 샷입니다 e에있는 다른 앱의 스크린 샷입니다. mulator 전체 창에 걸쳐, 잘 작동 :

enter image description here

편집

을 지금으로 내 XML 파일을 편집 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#00FF00" 
    > 
<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:text="Hello World, StackOverflow" 
    /> 
</LinearLayout> 

그리고 청소 및 구축, 실행하고있어 똑같은 견해. , 변화를 요구하지 않기 때문에 2

편집 나는 "수직"방향 라인을 제거했다.

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

    <uses-permission android:name="android.permission.INTERNET"></uses-permission> 

    <application android:label="@string/app_name" > 
     <activity android:name="HomeActivity" 
        android:label="@string/app_name"> 
     <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 
</manifest> 

추가 내 매니페스트에 다음과 같은 또 <application>

<supports-screens android:resizeable="true" 
         android:smallScreens="true" 
         android:normalScreens="true" 
         android:largeScreens="true" 

         android:anyDensity="true" /> 

잘못된 크기 미만 :

여기 내 AndroidManifest를합니다.

+2

선형 레이아웃의 배경색을 설정하십시오.그렇게하면 잘리는 TextView인지 또는 LinearLayout인지 확인할 수 있습니다. – Gophermofur

+0

@Gophermofur가 TextView에서 bg를 제거하고 LinearLayout에 추가하여 정리하고 빌드하고 실행하면 같은 결과보기 :-(. –

+0

manifest.xml을 게시 할 수 있습니까? – Gophermofur

답변

1

는 그것은 다른 화면 크기를 지원하는지 확인하려면 매니페스트를 확인 안드로이드 2.2 에뮬레이터

enter image description here

1

에서 잘오고. 이 품질 보증 (fill_parent is not filling entire screen in LinearLayout)

작은 크기, 보통 크기, 큰 크기의 화면 크기를 지원하도록 지정하지 않으면 레이아웃이 전체 화면을 채우지 못하는 문제가 발생할 수 있습니다.

+0

이것에 대한 큰 기대가 있었지만 작동하지 않았습니다. 참조 된, 깨끗한 + 빌드, 실행, 동일한 결과. –

관련 문제