2012-07-08 4 views
0

Google's android tutorial을 읽었으며 문제가 발생했습니다.
튜토리얼에서 XML 요소 (EditText 및 Button)를 설명하고 결국에는 프로그램 튜닝 방법을 설명합니다 버튼 + 텍스트 필드를 볼 수 있습니다.
문제는 에뮬레이터에 검은 색 화면이 표시되지 않는다는 것입니다.
나는 심지어에서 onCreate 함수에이 줄을 추가하는 시도 - http://pastebin.com/G5J9YjNe에뮬레이터에서 XML 내용을 표시하지 않습니다.

그리고 XML 파일 (I - 아직도 에뮬레이터는 검은 화면을 보여주고있다

System.out.println("Hello World!"); 

하지만 .. 다음은 된 .java 기본 파일입니다 어떤 코드가 어떤 파일인지 언급) - http://pastebin.com/VnRwAfMW

어떻게해야합니까?

감사합니다. 많은 도움을 주신 모든 분께!

답변

0
System.out.println("Hello World!"); 

화면에 아무 것도 인쇄하지 않습니다. 그것은 콘솔에서 볼 수 있습니다. 나는 아래 코드를 시도하고 나를 위해 잘 작동합니다.

// 주요 활동 공용 클래스 MainActivity는 활동을 확장 {

@Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.kuchbhi); 
     System.out.println("Hello World!"); 
    } 

레이아웃 /.xml

<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:orientation="horizontal" > 

    <EditText android:id="@+id/text_message" 
    android:layout_weight="1" 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:hint="enter text" /> 

    <Button android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:text="Send" /> 

    </LinearLayout> 

매니페스트 파일 ..

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

    <uses-sdk android:minSdkVersion="8" /> 

    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" > 
     <activity 
      android:name="MainActivity" 
      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> 

이 코드를 시도하고 저를 보자 너 뭐가 뭔지 알아.

소스 코드를 시험해 보았는데 제대로 작동합니다. 화면 참조

관련 문제