前提・実現したいこと
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/ツールのバージョンなど)
最新です。
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー