【问题标题】:Android spinner text sizeAndroid 微调器文本大小
【发布时间】:2011-10-18 21:19:29
【问题描述】:

由于一些设计问题,我正在设计宽度和高度较小的微调器。而这个较小的宽度和高度没有显示在微调器提示中写入的完整文本。 如果有任何解决方案可以减小微调器的文本大小,请提供帮助。

我附上问题的屏幕截图。

http://www.freeimagehosting.net/97147

【问题讨论】:

    标签: android view android-layout android-widget spinner


    【解决方案1】:

    根据您的需要使用以下代码...

    ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.Questions, R.layout.custom_spinner_list);
                adapter.setDropDownViewResource(R.layout.customer_spinner);
                spin.setAdapter(adapter);
    

    custom_spinner_list.xml

    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:text="@+id/TextView01"
        android:id="@+id/TextView01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="12dp"
        android:textColor="#000000">
    </TextView>
    

    customer_spinner.xml

    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:text="@+id/TextView01"
        android:id="@+id/TextView01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="12dp"
        android:textColor="#000000"
        android:height="42dp"
        android:gravity="center_vertical"
        android:padding = "2dp">
    </TextView>
    

    【讨论】:

    • 感谢 Vineet,这将在我们打开微调器时减小文本大小,但我希望在未打开的微调器上减小文本大小,以便它可以在我附加屏幕截图时显示框中的内容。
    • 确保在您定义微调器的 xml 中有 android:layout_height="wrap_content" 并且它在未打开的条件下也对我有用......请检查......
    【解决方案2】:

    尝试使用 android:paddingTop = "2dp" 或 android:paddingTop = "1dp" 等,哪个合适。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-17
      • 2011-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多