есть код моего макета:Android: Вид на дизайн предварительного просмотра не как реальный
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="119dp"
android:layout_height="84dp"
android:src="@drawable/image_template"
android:id="@+id/roleIco"
android:scaleType="fitCenter"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="the name of the player"
android:id="@+id/playerName"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:layout_marginTop="16dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp" />
<TextView
android:text="Role name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/roleName"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:layout_marginTop="16dp" />
<TextView
android:text="Fraction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/fractionName"
android:layout_marginTop="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
</LinearLayout>
<ImageView
android:layout_width="74dp"
android:layout_height="match_parent"
android:src="@drawable/icon_heart"
android:id="@+id/playerStatusIcon"
android:scaleType="fitCenter" />
</LinearLayout>
И проблема заключается в том, что в конструкции предварительного просмотра в Android Studio это выглядит следующим образом: See this image, please
Но когда я запустить это приложение на телефоне это выглядит следующим образом:
Кто-то может помочь мне в чем причина этой разницы и как ее устранить и изменить реальный взгляд на это, как на предварительном просмотре?
Спасибо за ответ;)
Вы имеете в виду цвет текста в предварительном просмотре ?? – Sanjeet
Вы не задали ориентацию для родительского линейного макета. Попробуйте настроить ориентацию на «горизонтальный». –
@Vaibhav Ориентация по умолчанию Agarwal всегда горизонтальная, даже если вы ее не определяете –