0

私のアプリはエミュレータに表示されますが、VSエミュレータをクリックすると、私のアプリの空白の白い画面が表示されます。私のアプリのUIがVSアンドロイドアプリエミュレータ(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> 

、A)私は、私は、このようなボタンや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

関連する問題