【发布时间】:2020-03-03 01:56:26
【问题描述】:
我在我的应用程序中使用了一些带有布局的卡片视图。 在某些设备上(小米 MI 9 SE Android 9、Galaxy Tab Active 2 Android 9)它看起来不错,而在其他设备上则不然(Emulator Pixel XL Android 9、Galaxy Tab 2 Android 7. 造成这种光学问题的原因是什么?
我的布局中的 CardView
<androidx.cardview.widget.CardView
android:id="@+id/cViewMail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_32sdp"
android:layout_marginTop="@dimen/_48sdp"
android:layout_marginEnd="@dimen/_32sdp"
app:cardCornerRadius="@dimen/_25sdp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vHeader">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cLayMailContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imgMailLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_18sdp"
android:alpha="0.3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_email_black_24dp" />
<EditText
android:id="@+id/etLoginusermail"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/_8sdp"
android:layout_marginTop="@dimen/_8sdp"
android:layout_marginEnd="@dimen/_18sdp"
android:layout_marginBottom="@dimen/_8sdp"
android:background="@android:color/transparent"
android:ems="10"
android:hint="@string/usermail"
android:inputType="textEmailAddress"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/imgMailLogo"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
模拟器 Pixel XL (Android 9)
小米米 9 SE (Android 9)
Galaxy Tab Active 2 (Android 9)
【问题讨论】:
-
看下面的答案
-
告诉我它是否有效