juahya 一个动态解析android layout xml 布局文件的框架

juahya

Juahya is android real time xml layout inflater

juahya 是一个动态解析androidlayout布局xml 文件的框架。
juahya 通过读取string 解析里面的android组件 包括自定义组件,封装成layout返回

可以添加自定义的view和自定义的标签来解析
项目地址:https://github.com/jixieshi999/juahya

version 1.1 2015-05-26

support android view
     CheckBox --》IFCheckBoxinflater
     EditText --》IFEditTextinflater
     ImageView--》IFImageViewinflater
     TextView--》IFTextViewinflater
support android layout   
     LinearLayout--》IFLinearLayout
     RelativeLayout--》IFRelativeLayout
     ScrollView--》IFScrollViewLayout

Demo

what can juahya do ?

你可以使用juahya来解析出view来,数据类型可以是string,stream,数据来源可以是web,sqlite,sdcard …

#

how to build your custom view inflater
    1.add IFXXX on com.xml.inflate.inflater
        xxx is android view
    2.config you IFxxx to com.xml.inflate.factory.IFLalterSImpleLinearLayoutFactory
    3.change your xml layout you can  see some of the things juahya used in his magic tricks ,

#

how to build your custom juahyaview inflater
    1.add IFJxxx on com.xml.inflate.inflater.juahya
        IFJxxx is extends IFXXX and add juahya ATTRIBUTE
    2.config you IFxxx to com.xml.inflate.factory.IFLalterSImpleLinearLayoutFactory
    3.change your xml layout you can  see some of the things juahya used in his magic tricks

Usage

        IFlateServicePoxy service = new IFlateServicePoxy();
        service.setIJuahyaLayoutInflateListener(DemoListActivity.this);
        String result="<LinearLayout android:orientation=\"vertical\" "
                    +" android:layout_width=\"fill_parent\" android:layout_height=\"fill_parent\" "
                    +"</LinearLayout>";
        View view= service.inflate(result, DemoListActivity.this);
        setContentView(view);

eg file test.xml

http://jixieshi999.github.io/ilife/juahya/test.xml

#

<TextView  android:layout_weight="1"
        android:layout_width="wrap_content" android:background="#e2e2c2"
        android:layout_height="fill_parent" android:gravity="center" 
        android:text="会员注册" />
<com.juahya.guis.JTextView  android:layout_width="200" android:gravity="center" android:layout_gravity="center"
    android:layout_height="wrap_content" android:background="#e2eff2"
    juahya:attrKey="action_save_upload"  android:text="保存"
     android:paddingTop="10" android:paddingBottom="10" 
    juahya:attrDescription="12331" 
    android:id="12331" 
    />
...
<ImageView 
    android:layout_width="wrap_content"  android:layout_gravity="center"
    android:layout_height="wrap_content"  
    android:background="@url/http://tupian.hbrc.com/joke/UpFilesnew/2012/6/23/201262303147971.jpg"
    />

#

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" >
    <!-- ......layout...... -->
    <TextView   android:layout_width="wrap_content"  android:layout_height="wrap_content"  
        android:text="输入用户名" />
</LinearLayout>

Acknowledgements

Android-Universal-Image-Loader for the img lazy loader

======
ps :
初版完成之后,联想了下,通过juahya可以与webservice或者ajax与后台交互做简单数据的采集

感觉像是一个简单的浏览器模型。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值