使用Eclipse,我創建了一個包含自定義組件(MyTextView,繼承自android.widget.TextView)的簡單Android項目。 我創建該文件後,在這裏我添加的屬性到這個類,如下面規定的attrs.xml:Eclipse不顯示我的自定義屬性(attrs.xml)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MyTextView" >
<attr name="AttributeOne" format="integer"/>
</declare-styleable>
</resources>
我在main.xml中加入一個目的線性佈局:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:mt="http://schemas.android.com/apk/res/myprogram.custom"
android:orientation="vertical"
android:layout_height="fill_parent" android:layout_width="fill_parent">
<myprogram.custom.MyTextView
android:text="MyTextView"
android:id="@+id/myTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</myprogram.custom.MyTextView>
</LinearLayout>
當我打開main.xml,並選擇選項卡'圖形佈局',選擇我的組件時,自定義屬性不會出現在Eclipse的選項卡'屬性'中,而是類繼承的原始屬性() .widget.TextVie w)出現。
這是一個錯誤?提交我的自定義屬性的過程是什麼? 還是我錯了?
謝謝。 盧西亞諾。
細節你嘗試再次關閉您的項目,並打開它?我注意到,除非我重新加載項目,否則Eclipse中的圖形佈局似乎不會更新(當您添加主題時)的主題。 – Gregory
是的,仍然不起作用... – Luciano