android Textview 常见效果

来源:互联网 发布:java邮件设置传输协议 编辑:程序博客网 时间:2024/06/06 11:01

 android:imeOptions="actionSearch"

1:跑马灯的效果

android:singleLine="true"android:ellipsize="marquee"android:focusableInTouchMode="true"android:focusable="true"android:marqueeRepeatLimit="marquee_forever"

  • android:singleLine=true 表示使用单行文字,多行文字也就无所谓使用Marquee效果了。
  • android:marqueeRepeatLimit,设置走马灯滚动的次数。
  • android:ellipsize,设置了文字过长时如何切断文字,可以有none, start,middle, end, 如果使用走马灯效果则设为marquee.
  • android:focusable,Android的缺省行为是在控件获得Focus时才会显示走马灯效果

2:超出几行点点的效果:
 android:maxLines="2" android:ellipsize="end"


3:自动链接的效果:
  android:autoLink="phone|email|map|web|all"



4:超出几行点点的效果:

5:Android 如何让EditText不自动获取焦点

解决之道:

<activity android:name=".ui.race.RaceSignUpAlipayActivity" android:windowSoftInputMode="stateAlwaysHidden"/>


6:

android:imeOptions属性

 

android软键盘的一些控制


自定弹出软键盘

     /**     * 自动弹出软键盘     * @param context     */    public static void autoPopSoftBorad(Activity context, EditText editText) {        try {            InputMethodManager m = (InputMethodManager) context. getSystemService(context.getApplicationContext().INPUT_METHOD_SERVICE);            m.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_NOT_ALWAYS);            editText.setFocusable(true);            editText.setFocusableInTouchMode(true);        } catch (Exception e) {            e.printStackTrace();        }    }
    /**     * 隐藏输入法面板     * 哪个veiw弹出的对话框,填那个view; 针对对话框弹出的软键盘做处理     */    public static void hideKeyboard(Activity c, View view) {        InputMethodManager imm = (InputMethodManager) c.getSystemService(c.INPUT_METHOD_SERVICE);        if (imm.isActive())        {            imm.hideSoftInputFromWindow(view.getWindowToken(), 0);        }    }

7:Edittext 其他的一些属性:

 android:imeOptions="actionSearch" 设置键盘的模式
 android:focusable="false" android:clickable="false" android:focusableInTouchMode="false"



1 1
原创粉丝点击