Я только что обновил compileSdkVersion
до 28 и использовал com.android.support:design:28.0.0
И у меня есть макет с парой TextInputEditText
и MaterialButton
, мой предварительный просмотр Android Studio (версия: 3.1.4) отличается от реального устройства (Samsung J5).
Layout Code:
<RelativeLayout 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"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
tools:context=".activity.LoginActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@drawable/ic_movie_creation_black_24dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textAlignment="center"
android:textSize="20sp"
android:layout_marginBottom="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/ic_email_black_24dp"
android:layout_marginEnd="5dp"/>
<android.support.design.widget.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/emailId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="5dp"
android:hint="Email-Id"
android:inputType="textEmailAddress" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/ic_lock_black_24dp"
android:layout_marginEnd="5dp"/>
<android.support.design.widget.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="5dp"
android:hint="Password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/ic_work_black_24dp"
android:layout_marginEnd="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#ececec">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Category:"
android:textColor="@color/primaryColor"
android:layout_marginStart="12dp"
android:layout_marginTop="5dp"
android:textSize="12sp"/>
<android.support.v7.widget.AppCompatSpinner
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="45dp">
</android.support.v7.widget.AppCompatSpinner>
</LinearLayout>
</LinearLayout>
<android.support.design.button.MaterialButton
android:id="@+id/btnLogin"
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@color/primaryColor"
android:text="Login"
android:textColor="#ffffff" />
</LinearLayout>
</RelativeLayout>
Предварительный просмотр реального устройства
Android Studio Preview
Нужно ли обновлять мою андроид студию? Пожалуйста, помогите