简体   繁体   中英

Creating custom XML widgets for Android UI

I'm trying to encapsulate certain layouts that I've made, to help me dry up my android xml ui files.

I have the following code:

        <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>

I want to simply convert it to the following

<DoubleTextView></DoubleTextView>

Once done I want to be able to use the "widgit" in other xml files. Are there any particular resources or examples that I can look at to help me figure out how to do this?

我更喜欢以下解释: 使用XML声明自定义android UI元素

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM