2010-11-17 87 views
2

我想封装我制作的某些布局,以帮助我干掉我的android xml ui文件。为Android UI创建自定义XML小部件

我有以下代码:

 <LinearLayout 
      android:id="@+id/LinearLayout02" 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:orientation="horizontal"> 

      <TextView 
       style="@style/text_view_small" 
       android:id="@+id/time"></TextView> 
      <TextView 
       style="@style/text_view_small" 
       android:id="@+id/number_of_worlds"> 
      </TextView> 
     </LinearLayout> 

我想简单地将其转换为以下

<DoubleTextView></DoubleTextView> 

一旦这样做我希望能够使用“widgit”在其他的XML文件。 是否有任何特定资源或示例可以帮助我了解如何执行此操作?

+0

的[声明使用XML定制的Android UI元素(可能的复制http://stackoverflow.com/questions/2695646/declaring-a-custom-android-ui-元件使用的XML) – 2016-03-03 20:37:49

回答