【问题标题】:Texts in NumberPicker are cut offNumberPicker 中的文本被截断
【发布时间】:2015-10-09 08:39:16
【问题描述】:

我有 NumberPicker 安全问题的对话。长文本被截断。如何解决这个问题?

这是对话框的布局内容

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">

<NumberPicker
    android:id="@+id/numberPicker"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_marginBottom="10dp" />
<com.aperto.ext.edekaapp.ui.CustomFontButton
    android:id="@+id/reg_fields_number_dialog_button"
    style="@style/BlueButton.Big"
    android:layout_width="match_parent"
    android:paddingBottom="10dp"
    android:paddingTop="10dp"
    android:text="@string/reg_fields_number_dialog_button_text" />
</LinearLayout>

【问题讨论】:

  • 你可以把new Line命令放在String上,比如:"Hello\n world",在中间使用\n
  • 是单行文本字段吗?
  • 你应该使用"Hello\nworld" 否则你会在新行中看到一个空格。
  • @Aspicas 数字选择器删除(忽略)新行(\n)
  • 那是因为你的文本字段是一个单行,试着改变它,你有XML吗?你能贴出来吗? @hhs

标签: android numberpicker


【解决方案1】:

我遇到了同样的问题。我设法通过给NumberPicker 一个大的layout_margin 来解决它。

添加此行后:

android:layout_margin="60dp"

我的号码选择器不再截断文本,而且似乎没有布局问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-24
    • 2011-12-04
    相关资源
    最近更新 更多