你好,游客 登录 注册 搜索
背景:
阅读新闻

Android 打包自己的自定义组件成JAR包

[日期:2011-08-18] 来源:Linux社区  作者:TerryBlog [字体:大 中 小]

导出完成后,我们就可以像使用其他JAR文件一样使用我们自己的自定义控件包了。下面给出一个小DEMO介绍如何使用这个JAR包。

 

步骤一:

新建文件夹lib,将jar 包放入。

步骤二:

关联JAR包,如下图:

 

 

步骤三,使用JAR包: 

如下代码:

 <LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"

    xmlns:gif="http://schemas.android.com/apk/res/com.terry.jarTest" 
    android:id
="@+id/layout" android:orientation="vertical"
    android:layout_width
="fill_parent" android:layout_height="fill_parent">



    
<Button android:text="停止" android:id="@+id/Button01"
        android:layout_width
="wrap_content" android:layout_height="wrap_content"></Button>
    
<Button android:text="开始" android:id="@+id/Button02"
        android:layout_width
="wrap_content" android:layout_height="wrap_content"></Button>



    
<com.terry.gif.TypegifView
        
android:layout_width="fill_parent" android:id="@+id/gifView1"
        gif:stop
="true" android:layout_height="wrap_content" 
        gif:delay
="1"></com.terry.gif.TypegifView>



</LinearLayout>
 
有一个不好的就是如果你项目中存在使用属性,必须也把属性一起复制到你要使用的项目中,要不然会识别不了。
linux
相关资讯       Android开发 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款