0

내 응용 프로그램은 에뮬레이터에 표시되지만 VS 에뮬레이터를 클릭하면 내 응용 프로그램의 빈 흰색 화면이 표시됩니다.내 앱의 UI가 VS android 앱 에뮬레이터 (API 레벨 19와 23 모두)에 표시되지 않는 이유는 무엇입니까?

`<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
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" 
    tools:context="com.example.android.fantappstic_app.HomeScreen"> 

    <TextView 
     android:id="@+id/login_welcome" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Welcome to App!" 
     android:textSize="36sp" 
     tools:layout_editor_absoluteY="47dp" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" /> 

    <EditText 
     android:id="@+id/user_field" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:ems="10" 
     android:inputType="textPersonName" 
     android:text="Username" 
     app:layout_constraintHorizontal_bias="0.502" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     tools:layout_editor_absoluteY="258dp" /> 

    <EditText 
     android:id="@+id/pass_field" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:ems="10" 
     android:inputType="textPassword" 
     android:text="Password" 
     app:layout_constraintHorizontal_bias="0.502" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     tools:layout_editor_absoluteY="325dp" /> 

    <Button 
     android:id="@+id/login_button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="74dp" 
     android:onClick="login" 
     android:text="Log In" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" /> 

    <Button 
     android:id="@+id/signup_button" 
     style="@style/Widget.AppCompat.Button.Borderless" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="148dp" 
     android:text="Sign Up" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintBottom_toBottomOf="parent" 
     android:layout_marginBottom="16dp" /> 
</android.support.constraint.ConstraintLayout> 

그리고 마지막으로, 여기 내의 AndroidManifest.xml 파일은 다음과 같습니다 enter image description here

다음은 내 FirstLogin 활동

package com.example.android.fantappstic_app; 

import android.content.Intent; 
import android.support.v7.app.AppCompatActivity; 
import android.os.Bundle; 
import android.view.View; 
import android.widget.Button; 
import android.widget.EditText; 
import android.widget.Toast; 

public class FirstLogin extends AppCompatActivity { 

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

     Button login_button = (Button) findViewById(R.id.login_button); 
     final EditText user_field = (EditText)findViewById(R.id.user_field); 
     final EditText pass_field = (EditText)findViewById(R.id.pass_field); 
     Button signup_button = (Button) findViewById(R.id.signup_button); 

     login_button.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View v) { 

       if(user_field.getText().toString().equals("codergal") && pass_field.getText().toString().equals("12345")) 
       { 
        Intent GotoHomeScreen = new Intent(FirstLogin.this, HomeScreen.class); 
        FirstLogin.this.startActivity(GotoHomeScreen); 
      } 

       else 
       { 
        Toast.makeText(getApplicationContext(), "Wrong Credentials",Toast.LENGTH_SHORT).show(); 

     } 

    } 
}); 
     signup_button.setOnClickListener(new View.OnClickListener() { 
      @Override 

      public void onClick(View v) { 
       Intent GotoSignUpBasic = new Intent(FirstLogin.this, SignUpBasicInfo.class); 
       FirstLogin.this.startActivity(GotoSignUpBasic); 
      } 
     }); 
    }} 

아래 FirstLogin 활동에 대한 내 XML 파일은 내 코드입니다. FirstLogin을 HomeScreen 활동의 부모 함수로 추가했습니다. 그래서 기본적으로

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

    <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=".HomeScreen" 
      android:parentActivityName=".FirstLogin"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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

    </application> 

</manifest> 

하는) 내가 같은 버튼과 TextViews와 같은 구성 요소를 설계했지만 그들은 VS 에뮬레이터에 표시되지 않음) B 어디서나 오류를받지 못했습니다. 또한, 내 VS 에뮬레이터는 5.7 "마쉬 멜 로우 (6.0.0) XHDPI 전화 API 레벨 23입니다. 나는 또한 다른 장치로 5"KitKat (4.4) XXHDPI 전화 API 레벨 19도 시도했습니다.

+0

홈 액티비티의 내용은 무엇입니까? – InziKhan

+0

@InziKhan 현재로서는 내부에 아무것도 코딩하지 않았습니다. –

답변

0

다음은 올바른 코드입니다.

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

      <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=".FirstLogin" 
        > 
        <intent-filter> 
         <action android:name="android.intent.action.MAIN" /> 

         <category android:name="android.intent.category.LAUNCHER" /> 
        </intent-filter> 
       </activity> 
<activity android:name=".HomeScreen" 
      android:parentActivityName=".FirstLogin" /> 
       <activity android:name=".SignUpBasicInfo"></activity> 

      </application> 

     </manifest> 
+0

변경된 사항은 무엇입니까? 내 앱에서 에뮬레이터에 나타나는 것을 차단하는 문제는 무엇 이었습니까? –

+0

안드로이드 응용 프로그램 매니페스트 파일에서 Android os에게 어떤 활동이 먼저 시작되어야하는지 알려줍니다. 이제 막 시작 활동으로 Firstlogin 활동을 선언했습니다. – InziKhan

+0

내 코드가 작동하면 대답을 수락합니다. – InziKhan

관련 문제