本文介绍了变化的EditText SETERROR绘制引力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关的EditText了,难道真的充满了RTL文本,有没有办法来改变错误绘制的比重(当然弹出)?

For EditText that going be filled with RTL text, is there a way to change the gravity of the error drawable (and popup of course) ?

下面是经常出现偏差,可绘制的例子

here is an example of regular error drawable

所以,因为输入的文本是RTL我想弹出的EditText上的左侧显示

so since the text entered is RTL i would like the pop up to show up at the LEFT side of the EditText

我试图应用自定义绘制,但似乎没有任何setGravity方法。

i tried to apply custom drawable , but Drawable doesnt seem to have any setGravity method.

先谢谢了。

推荐答案

这不是通过正常的手段可能的,但是你可以扩展了Android的TextView类,并更改Android使用充气弹出的布局。我还没有尝试过这个自己,但它可以工作。

It's not possible by normal means, however you can extend the Android TextView class and change the layout that Android uses to inflate the popup. I haven't tried this myself but it could work.

我做了一个快速浏览一下<一个href=\"http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android/1.5_r4/android/widget/TextView.java\"相对=nofollow> TextView的源,发现这一行

I did a quick look in the source of TextView and found this line

final TextView err = (TextView) inflater.inflate(com.android.internal.R.layout.textview_hint,
                   null);

其中引用<一个href=\"https://$c$c.google.com/p/jota-text-editor/source/browse/trunk/res/layout/textview_hint.xml?r=56\"相对=nofollow>这个布局。

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/popup_inline_error"
    android:textAppearance="?android:attr/textAppearanceSmallInverse"
/>

添加重力这里可以做的伎俩。为绘制类似的方法可以适用。

Adding gravity here could do the trick. A similar approach for the drawable could apply.

这篇关于变化的EditText SETERROR绘制引力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 08:28