Android Studio “懒人”必备插件android layout id converter

在一个布局文件里。假设定义了非常多非常多id,代码中一个个findview是一件非常枯燥而且浪费时间的事情。

所以这里向大家推荐一个必备插件android layout id converter。

配置完毕后仅仅须要在xml文件右键点击Convert android layout xml,然后在你activity中仅仅须要粘贴,就能够帮助你自己主动生成代码。例如以下这些就是自己主动生成的:

private WheelView wheelview;
private ScrollView scrollView1;
private LinearLayout vName;
private EditText etName;
private LinearLayout vMobile;
private EditText etMobile;
private EditText etCard;
private EditText etCarOwnerName;
private LinearLayout vCarOwnerMobile;
private EditText etCarOwnerMobile;
private EditText etInsuranceCompany;
private EditText etInsuranceNum;
private EditText etBank;
private EditText etBankNumber;
private RelativeLayout vCarType;
private AppCompatSpinner spCarType;
private EditText etCarTonnage;
private TextView tvCarNum;
private EditText etCarNum;
private LinearLayout vTrailerCarNum;
private TextView tvTrailerCarNum;
private EditText etTrailerCarNum;
private ImageView iv1;
private ImageView iv3;
private ImageView iv5;
private ImageView iv2;
private ImageView iv4;
private EditText etFamilyName;
private EditText etFamilyTel;
private EditText etRelation;
private Button btnSubmit; private void assignViews() {
wheelview = (WheelView) findViewById(R.id.wheelview);
scrollView1 = (ScrollView) findViewById(R.id.scrollView1);
vName = (LinearLayout) findViewById(R.id.v_name);
etName = (EditText) findViewById(R.id.et_name);
vMobile = (LinearLayout) findViewById(R.id.v_mobile);
etMobile = (EditText) findViewById(R.id.et_mobile);
etCard = (EditText) findViewById(R.id.et_card);
etCarOwnerName = (EditText) findViewById(R.id.et_carOwnerName);
vCarOwnerMobile = (LinearLayout) findViewById(R.id.v_carOwnerMobile);
etCarOwnerMobile = (EditText) findViewById(R.id.et_carOwnerMobile);
etInsuranceCompany = (EditText) findViewById(R.id.et_insuranceCompany);
etInsuranceNum = (EditText) findViewById(R.id.et_insuranceNum);
etBank = (EditText) findViewById(R.id.et_bank);
etBankNumber = (EditText) findViewById(R.id.et_bankNumber);
vCarType = (RelativeLayout) findViewById(R.id.v_carType);
spCarType = (AppCompatSpinner) findViewById(R.id.sp_carType);
etCarTonnage = (EditText) findViewById(R.id.et_car_tonnage);
tvCarNum = (TextView) findViewById(R.id.tv_carNum);
etCarNum = (EditText) findViewById(R.id.et_carNum);
vTrailerCarNum = (LinearLayout) findViewById(R.id.v_trailerCarNum);
tvTrailerCarNum = (TextView) findViewById(R.id.tv_trailerCarNum);
etTrailerCarNum = (EditText) findViewById(R.id.et_trailerCarNum);
iv1 = (ImageView) findViewById(R.id.iv1);
iv3 = (ImageView) findViewById(R.id.iv3);
iv5 = (ImageView) findViewById(R.id.iv5);
iv2 = (ImageView) findViewById(R.id.iv2);
iv4 = (ImageView) findViewById(R.id.iv4);
etFamilyName = (EditText) findViewById(R.id.et_family_name);
etFamilyTel = (EditText) findViewById(R.id.et_family_tel);
etRelation = (EditText) findViewById(R.id.et_relation);
btnSubmit = (Button) findViewById(R.id.btn_submit);
}
上一篇:EJB之Timer


下一篇:JVM体系结构之三:方法区之2(jdk1.6,jdk1.7,jdk1.8下的方法区变迁)