点击一键切换让文本从不可以编辑到编辑状态

这篇博客介绍了如何在Android应用中实现点击按钮,使多个EditText从不可编辑变为可编辑。通过遍历并设置EditText的焦点、触摸模式和启用状态,实现一键切换编辑状态的功能。
摘要由CSDN通过智能技术生成

这里写图片描述
1.有时候我们app中经常出现一些需求,点击右上角的按钮“编辑”就会变成“完成”,文本里面的EditText从不可以编辑输入到可编辑输入
这里写图片描述
2.很简单直接上布局

 <RelativeLayout
        android:id="@+id/parttime_type"
        android:layout_width="match_parent"
        android:layout_height="43dp"
        android:layout_marginLeft="14dp"
        android:layout_marginRight="14dp"
        android:layout_marginTop="14dp" >

        <TextView
            android:id="@+id/tv_parttime_type"
            style="@style/publish_jobs_left_title"
            android:text="类型" />

        <TextView
            android:id="@+id/tv_input_parttime_type"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:drawableRight="@drawable/icon_expand_down"
            android:gravity="center"
            android:text="企业"
            android:textColor="@color/new_gray_666666"
            android:textSize="16sp" />

        <View
            android:id="@+id/view1"
            android:layout_width="match_parent"
            android:layout_height="1px"
            android:layout_alignParentBottom="true"
            android:background="@color/hint_gray" />
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/parttime_title"
        android:layout_width="match_parent"
        android:layout_height="43dp"
        android:layout_marginLeft="14dp"
        android:la
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值