質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.47%
Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

1回答

348閲覧

androidstudioでプレビューとエミュの表示が異なる

programing837

総合スコア6

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2020/01/12 15:16

前提・実現したいこと

android studio で、LinearLayoutを使ってEditTextとButtonを配置したんですが、プレビューとエミュで表示が異なります。プレビューではきちんと表示されてますが、エミュでは画面真っ白です。エミュにも反映させるにはどのようにしたらよいですか?

発生している問題・エラーメッセージ

該当のソースコード

<?xml version="1.0" encoding="utf-8"?>

<androidx.coordinatorlayout.widget.CoordinatorLayout 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=".MainActivity">

<com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" app:srcCompat="@android:drawable/ic_dialog_email" /> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <EditText android:id="@+id/myEditText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:hint="Your Name..." android:inputType="textPersonName" /> <Button android:id="@+id/MyButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="getScore" android:text="Submit" /> </LinearLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

試したこと

ここに問題に対して試したことを記載してください。

補足情報(FW/ツールのバージョンなど)

最新です。

ここにより詳細な情報を記載してください。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

s.m_1

2020/01/13 04:44

表示させている Activity もしくは Fragment のソースコードも載せると回答しやすいかと思います.
guest

回答1

0

自己解決

activityが生成されてないだけでした。いつのまにかonCleateを消してしまっていたようです。

投稿2020/01/14 15:02

programing837

総合スコア6

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.47%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問