【问题标题】:EditText single line issue on Galaxy TabGalaxy Tab 上的 EditText 单行问题
【发布时间】:2012-10-01 08:30:08
【问题描述】:

我的布局中有一个编辑/文本:

<EditText
                    android:id="@+id/url"
                    android:layout_width="fill_parent"
                    android:layout_height="25dp"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="5dp" 
                    android:background="@drawable/url_edit_text_bg"
                    android:ellipsize="end"
                    android:gravity="left|center_vertical"
                    android:inputType="textUri"
                    android:lines="1"
                    android:maxLines="1"
                    android:paddingLeft="5dp"
                    android:paddingRight="5dp"
                    android:scrollHorizontally="true"
                    android:selectAllOnFocus="true"
                    android:singleLine="true"
                    android:textColor="@android:color/black"
                    android:textCursorDrawable="@null"
                    android:textSize="12sp" />  

但在我的 Galaxy tab 10.1 设备上,我无法在此 EditText 的一行中看到长文本。

此问题仅在 Galaxy tab 10.1 和 Ideapad Tab K1 上出现适合单行。
有几个设备会出现这个问题?
如何解决? 请帮忙...
谢谢。

【问题讨论】:

  • 将布局高度设为 wrap_content。

标签: android android-layout android-edittext galaxy-tab


【解决方案1】:

这是标准行为。您可以尝试在任何浏览器中执行此操作。

【讨论】:

    【解决方案2】:

    为什么要给 EditText 提供恒定的高度?

    进行以下更改:

    android:layout_height="wrap_content"
    

    【讨论】:

    • 我用作 EditText 背景的 drawable 是一个 9 补丁。而且我在 EditText 旁边有一个按钮,我需要将 EditText 的高度与按钮的高度相匹配,所以我为它指定了一个特定的高度。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-18
    • 1970-01-01
    • 2011-05-25
    • 2011-06-02
    • 1970-01-01
    相关资源
    最近更新 更多