Android????????????????л?
???????????? ???????[ 2015/8/18 10:49:11 ] ??????????????? ???????
???????????layoutInflater.inflate(R.layout.main?? null??false)?????????????R.layout.main???id?????????????????????????????????μ??????洢??sd???У??????????????????????????LayoutInflater??api??????????inflate(XmlPullParser parser?? ViewGroup root??boolean attachToRoot)?????????????????·???????????xmlPullParser:
????public XmlPullParser getXmlPullParser(String resource) {
????XmlPullParser parser = Xml.newPullParser();
????try {
????// InputStream is=mContext.getAssets().open("transfer_main.xml");
????FileInputStream is = new FileInputStream(resource);
????parser.setInput(is?? "utf-8");
????} catch (Exception e) {
????e.printStackTrace();
????}
????return parser;
????}
???????????????????????????????????????????????demo???????????????????????????????????
????????????????????????????????????????res/layout/xxx.xml??????????????????id?????????е???????????????????id???text??????drawble????????????R????????????????????????????????????????????????????????????о???apk???????????????????????????????????id????????????????View???????????
????protected View onCreateView(String name?? AttributeSet attrs)
????throws ClassNotFoundException {
????// return createView(name?? "android.view."?? attrs);
????return createView(name?? "com.xxx.xxxx.viewanalysis.view.VA"?? attrs); //????com.xx.view.VATextView ??????????view ?????TextView
????}
?????????е????????д????????TextView???????????????????????????TextView??????????????????????????????????????????巽????????????????View????????????????????????view?????????????????????????????????????????9???????Button??GridView??RelativeLayout????????ж????view???????????У????±???????ClassNotFoundException????
????VAButton??????
????public class VAButton extends android.widget.Button {
????public VAButton(Context context?? AttributeSet attrs) {
????super(context);
????setAttributeSet(attrs);
????}
????@SuppressWarnings("deprecation")
????public void setAttributeSet(AttributeSet attrs) {
????HashMap<String?? ParamValue> map = YDResource.getInstance().getViewMap();
????int count = attrs.getAttributeCount();
????for (int i = 0; i < count; i++) {
????ParamValue key = map.get(attrs.getAttributeName(i));
????if (key == null) {
????continue;
????}
????switch (key) {
????case id:
????this.setTag(attrs.getAttributeValue(i));
????break;
????case text:
????String value = YDResource.getInstance().getString(
????attrs.getAttributeValue(i));
????this.setText(value);
????break;
????//case...
????default:
????break;
????}
????}
????}
????Ps: view id????????????????????????????????demo??
??????????????????????????????????????????????????????
????demoЧ?????
????????е?Ч?????
??????????????demo?е???????
????????????????????YDLayoutInflater??ParamValue?????????9???????view??
????YDLayoutInflater????????LayoutInflater??????????Щ????????????????????????????????
??????????????????
?????????????????·???????????????У?Ч??????????????Щ????淶??????????????????????????????????????????????£?????д????и??????????????????
??????

???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44