Android视图多态性
我有一个扩展RelativeLayout的自定义android视图: 在我的主要活动中,我有一个带有自定义适配器的ListView。描述ListView中每一行的布局在list_item_module.xml中给出:Android视图多态性,android,polymorphism,Android,Polymorphism,我有一个扩展RelativeLayout的自定义android视图: 在我的主要活动中,我有一个带有自定义适配器的ListView。描述ListView中每一行的布局在list_item_module.xml中给出: ModuleTriggerView视图使用3个不同的其他视图进行多态扩展 如何将每个com.Modules.ModuleTriggerView设置为正确的类型?(继承类的类型,而不是父类) 谢谢大家! public class ModuleTriggerView exten
ModuleTriggerView视图使用3个不同的其他视图进行多态扩展
如何将每个com.Modules.ModuleTriggerView设置为正确的类型?(继承类的类型,而不是父类)
谢谢大家!
public class ModuleTriggerView extends RelativeLayout
<LinearLayout
android:id="@+id/module_line_clickable_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:orientation="vertical" >
<TextView
android:id="@+id/module_name_string"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/module_type_string"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" />
</LinearLayout>
<Button
android:id="@+id/show_module_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="@string/button_show_module" />