【问题标题】:How to set an non editable text on left side of edit text in android?如何在android中的编辑文本左侧设置不可编辑的文本?
【发布时间】:2015-05-13 07:12:50
【问题描述】:

众所周知,我们可以使用

EditText 上设置drawable_left
edittext.setcCompoundDrawablesWithIntrinsicBounds(R.drawable.icon,0,0,0);

是否可以在编辑文本的左侧设置一个不可编辑的文本说“A”?

【问题讨论】:

标签: android text


【解决方案1】:

您可以这样做(例如,值是):

<RelativeLayout android:layout_width="wrap_content"
                android:layout_height="wrap_content">
    <TextView android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="A"
              android:layout_marginRight="10dp"/>
    <EditText android:layout_width="100dp"
              android:layout_height="25dp"
              android:id="@+id/editTextView"
              android:layout_marginLeft="40dp"/>
</RelativeLayout>

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多