Android - EditText正在调整输入数据的时间

时间:2015-10-12 14:07:01

标签: android

非常奇怪的情况,当用户将文本输入编辑文本时,而不是像往常一样填充编辑文本随着每个输入而变宽

屏幕截图1在

之前

Before

然后截图2显示了edittext如何变大而不是填充可用空间

After

有什么想法,为什么要这样做?

这是我的edittext

的xml
<div class="slogan valign-middle">
    <div>
        <p> <span>Text here</span>

            <img src="https://cdn3.iconfinder.com/data/icons/rcons-social/32/blog_blogger_google-128.png" id="chat_link_35" title="click to start live chat ..">
        </p>
    </div>
    <div> <span class="heading">National Helpline</span>
 <span>Hello</span>

    </div>
    <div> <span class="heading" style="color:orange">National Helpline</span>
 <span>Hello</span>

    </div>
</div>

2 个答案:

答案 0 :(得分:1)

使用weight时(在水平LinearLayout上),您需要指定宽度等于0dp而不是wrap_content

android:layout_width="0dp"

答案 1 :(得分:1)

将android:layout_width =“0dp”保持为0dp,然后权重正常工作

<EditText
            android:layout_width="0dp"
            android:layout_height="40dp"
            android:id="@+id/text_name"
            android:visibility="invisible"
            android:inputType="text"
            android:layout_gravity="center_vertical"
            android:layout_weight="0.47" />