现在的位置: 首页 > 综合 > 正文

一个button设置EditText状态可编辑及不可编辑

2017年03月25日 ⁄ 综合 ⁄ 共 616字 ⁄ 字号 评论关闭
</pre><p>java代码</p><p></p><pre code_snippet_id="414956" snippet_file_name="blog_20140703_2_4783598" name="code" class="java">//设置不可编辑
		call.setFocusable(false);
		call.setFocusableInTouchMode(false);
		

设置button中开关可编辑及不可编辑

//设置输入框控件可编辑 焦点在输入框控件上
				call.setFocusable(true);
				call.setFocusableInTouchMode(true);
				

//设置输入框控件不可编辑 焦点不在输入框控件上
				call.setFocusable(false);
				call.setFocusableInTouchMode(false);
				


xml代码

<span style="white-space:pre">	</span><EditText 
              android:id="@+id/mycard_main_call"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="*********"
              android:background="@null"
              style="@style/StyleTextInfoGray12_2"
              />

抱歉!评论已关闭.