我正在構建可在所有屏幕尺寸上工作的Android應用程序,我將sp用於文本大小,但在不同的android屏幕上字體大小存在問題。無法處理所有屏幕尺寸的字體大小
10英寸平板電腦附帶的照片,任何人都可以幫助我嗎?
截圖:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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">
//在這種TesxtView我使用SP代替DP。
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/_6sdp"
android:layout_marginEnd="@dimen/_6sdp"
android:layout_marginLeft="@dimen/_6sdp"
android:layout_marginRight="@dimen/_6sdp"
android:layout_marginStart="@dimen/_6sdp"
android:layout_marginTop="@dimen/_110sdp"
android:text="Username"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="@+id/rectangle_login"
app:layout_constraintLeft_toLeftOf="@+id/rectangle_login"
app:layout_constraintRight_toRightOf="@+id/rectangle_login"
app:layout_constraintStart_toStartOf="@+id/rectangle_login"
app:layout_constraintTop_toTopOf="@+id/rectangle_login" />
</android.support.constraint.ConstraintLayout>
請添加一些示例代碼/例如,以補充你的答案。目前這是Link Only的答案。見https://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers –