package safeluck.drive.evaluation.fragment.rulefragments.cview;
|
|
import android.content.Context;
|
import android.content.res.TypedArray;
|
import android.text.Editable;
|
import android.text.TextWatcher;
|
import android.util.AttributeSet;
|
import android.view.LayoutInflater;
|
import android.view.View;
|
import android.widget.EditText;
|
import android.widget.LinearLayout;
|
import android.widget.TextView;
|
|
import safeluck.drive.evaluation.R;
|
|
/**
|
* DriveJudge
|
* Created by lzw on 2020/9/23. 15:10:43
|
* 邮箱:632393724@qq.com
|
* All Rights Saved! Chongqing AnYun Tech co. LTD
|
*/
|
public class TextEditText extends LinearLayout {
|
|
private TextView tv_des;
|
private EditText editText;
|
|
public TextEditText(Context context) {
|
this(context,null);
|
|
}
|
|
|
|
public TextEditText(Context context, AttributeSet attrs) {
|
this(context,attrs,0);
|
|
}
|
|
public TextEditText(Context context, AttributeSet attrs, int defStyleAttr) {
|
this(context, attrs, defStyleAttr,0);
|
}
|
|
public TextEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
super(context, attrs, defStyleAttr, defStyleRes);
|
initView(context,attrs);
|
}
|
|
private void initView(Context context, AttributeSet attrs) {
|
View view = LayoutInflater.from(context).inflate(R.layout.layout_viewgroup_tv_edit,this,true);
|
int[] textEditText_attr = R.styleable.TextEditText_attr;
|
TypedArray typedArray = context.obtainStyledAttributes(attrs, textEditText_attr);
|
String des = typedArray.getString(R.styleable.TextEditText_attr_txt_des_tvedit);
|
String input = typedArray.getString(R.styleable.TextEditText_attr_et_input);
|
tv_des = view.findViewById(R.id.tv_des);
|
editText = view.findViewById(R.id.et_value_setting);
|
|
editText.setText(input);
|
|
editText.addTextChangedListener(new TextWatcher() {
|
@Override
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
}
|
|
@Override
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
}
|
|
@Override
|
public void afterTextChanged(Editable s) {
|
|
}
|
});
|
tv_des.setText(des);
|
}
|
|
public String getInput(){
|
String edite = editText.getText().toString().trim();
|
return edite;
|
}
|
}
|