1、子控件不受父控件的大小的控制
android:clipChildren="false"

2、TextView/ EditText 单行显示

android:singleLine="true"

3、EditText字数限制

android:maxLength="100"

  <FrameLayout       android:id="@+id/content_appraise"       android:layout_below="@id/t54yh67u"       android:background="#ffffff"       android:orientation="vertical"       android:layout_marginTop="9dip"       android:layout_marginLeft="10dp"       android:layout_marginRight="10dp"       android:paddingBottom="8dp"       android:paddingTop="8dp"       android:paddingLeft="8dp"       android:paddingRight="8dp"           android:layout_width="match_parent"       android:layout_height="170dp" >             <EditText            android:id="@+id/et_appraise_content"           android:layout_width="match_parent"           android:layout_height="match_parent"           android:paddingLeft="8dp"           android:paddingTop="8dp"           android:gravity="left"           android:background="@null"           android:hint="请填写对医生回答的评论(选填)"           android:maxLength="100"/>             <TextView           android:id="@+id/tv_num_limit_content"           android:layout_width="match_parent"           android:layout_height="match_parent"           android:gravity="right|bottom"           android:text="0/100" >                  </TextView>              </FrameLayout>

然后再Activity中监听EditText的变化。

tv_num_limit_content = (TextView) this.findViewById(R.id.tv_num_limit_content) ;        et_appraise_content = (EditText) this.findViewById(R.id.et_appraise_content);        et_appraise_content.addTextChangedListener(new TextWatcher() {            @Override            public void afterTextChanged(Editable arg0) {                            }            @Override            public void beforeTextChanged(CharSequence arg0, int arg1,                    int arg2, int arg3) {                            }            @Override            public void onTextChanged(CharSequence arg0, int arg1, int arg2,                    int arg3) {                tv_num_limit_content.setText(""+arg0.length()+"/100");            }                    });

更多相关文章

  1. 怎么给Android(安卓)控件添加边框(样式)?
  2. RelativeLayout
  3. android 自定义控件(邮箱边写边出格式邮箱)
  4. 自定义控件--虚线
  5. fullScreen时的软键盘监听(非重写Layout方式)
  6. Android(安卓)自绘输入框
  7. android之4.0控件switch自定义开关滑块、滑块轨道和宽度
  8. Android中WebView控件的使用
  9. android 五种 布局文件

随机推荐

  1. mysql无法登陆修复
  2. SQL主键的外键问题
  3. Amoeba实现mysql主从读写分离1
  4. 查询从wordnet mysql获取反义词?
  5. Mysql 命令行快速导入数据
  6. Qt通过ODBC连接SQL Server2008实践总结
  7. Oracle SQL Developer是一个与c#一起使用
  8. mysql中insert...select引发的死锁
  9. SQL对多个列分别进行合并的操作,100分送
  10. [置顶] SQL Server 日期相关