zoukankan      html  css  js  c++  java
  • inputType导致TextView不能多行显示

    今天遇到一个问题很纳闷,那就是TextView不能自动换行多行显示,因为我的印象是TextView默认是可以自动换行多行显示的,今儿个怎么就不行呢。

    最终找到原因,是因为设置了inputType属性导致的。

    布局文件代码:

     1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     2     xmlns:tools="http://schemas.android.com/tools"
     3     android:layout_width="match_parent"
     4     android:layout_height="match_parent"
     5     android:paddingBottom="@dimen/activity_vertical_margin"
     6     android:paddingLeft="@dimen/activity_horizontal_margin"
     7     android:paddingRight="@dimen/activity_horizontal_margin"
     8     android:paddingTop="@dimen/activity_vertical_margin"
     9     tools:context=".MainActivity" >
    10 
    11     <TextView
    12         android:layout_width="wrap_content"
    13         android:layout_height="wrap_content"
    14         android:inputType="text"
    15         android:text="今天你吃了吗?今天你吃了吗?今天你吃了吗?今天你吃了吗?今天你吃了吗?今天你吃了吗?"/>
    16 
    17 </RelativeLayout>
     

    显示效果如下图:

      

    现象很明显,没有显示出所有的文字内容,也没有自动换行显示。

    最后找到问题是我无意中设置了inputType属性所导致的,删除该属性即可解决问题。

    虽然是个小问题,但是花了我十来分钟才发现问题的所在,所以记录下来以备后用。

  • 相关阅读:
    configure.ac:91: error: possibly undefined macro: AC_SEARCH_LIBS
    debian上安装tmux
    ssh: Bad configuration option: usedns
    mysql启动失败“MySQL Daemon failed to start”
    批量查询文件的编码格式
    mysql计算QPS
    网络资源汇总
    jQuery Mobile + HTML5
    配置SQL Server 2008 R2 Reporting Services
    分享一个C#创建Barcode的DLL
  • 原文地址:https://www.cnblogs.com/TonyChan7/p/3809734.html
Copyright © 2011-2022 走看看