-1

我正在开发一个安卓应用程序。任何人都可以告诉我或发送有关文本如何在 android 中显示的任何链接。就图像而言,我们可以在 dp 中指定大小以保持大小不变​​。如何为 android 执行此操作以使其在设备之间保持可读?

4

2 回答 2

2

您可以使用 SP 单位指定文本大小。

同样,您应该更喜欢 sp(与比例无关的像素)来定义文本大小。sp 缩放因子取决于用户设置,系统缩放大小与对 dp 的缩放相同。

参考Android Docs on Supporting Multiple Screens

于 2012-07-31T12:25:35.380 回答
0
<?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="match_parent"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/textViewOrderProduct"
        android:layout_width="wrap_content"
        android:layout_height="45dp"
        android:layout_marginLeft="5dp"
        android:onClick="hideKeyBord"
        android:text="123"
        android:textSize="15dp"
        android:width="100dp" />

    <EditText
        android:id="@+id/editTextOrderQty"
        android:layout_width="wrap_content"
        android:layout_height="45dp"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="8dp"
        android:background="#ffffff"
        android:inputType="number"
        android:maxLength="4"
        android:text="123"
        android:textSize="13dp"
        android:width="50dp" />

    <EditText
        android:id="@+id/editTextOrderprice"
        android:layout_width="wrap_content"
        android:layout_height="45dp"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="8dp"
        android:background="#ffffff"
        android:inputType="number"
        android:maxLength="5"
        android:text="123"
        android:textSize="13dp"
        android:width="50dp" />

    <TextView
        android:id="@+id/textViewOrderStock"
        android:layout_width="wrap_content"
        android:layout_height="45dp"
        android:layout_marginLeft="5dp"
        android:onClick="hideKeyBord"
        android:text="123"
        android:textSize="13dp"
        android:width="50dp" />

</LinearLayout>
于 2012-07-31T12:23:45.317 回答