पर बुलाया नहीं प्राप्त करता है मैं एक कस्टम दृश्य बनाया:कस्टम दृश्य निर्माता एंड्रॉयड 5.0.2
public class SomeView extends View
कस्टम दृश्य कंस्ट्रक्टर्स:
public SomeView (Context context)
{
super(context);
}
// Called when view is inflated from xml
public SomeView (Context context, AttributeSet attrs)
{
super(context, attrs);
}
// Perform inflation from XML and apply a class-specific base style from a theme attribute.
public SomeView (Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
}
मैं भी साथ एपीआई 21 से 4 निर्माता की कोशिश की कोई भाग्य:
public VeediView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
{
super(context, attrs,defStyleAttr, defStyleRes);
}
XML लेआउट में मैं इस दृश्य को परिभाषित कर रहा हूँ और सब कुछ ठीक काम करते हैं।
गैलेक्सी एस 2 पर परीक्षण ठीक काम करता है और दृश्य कन्स्ट्रक्टर को कॉल किया जाता है लेकिन नेक्सस -7 एंड्रॉइड 5.0.2 पर ऐप चलाने पर रचनाकारों को बिल्कुल कॉल नहीं किया जाता है।
कोई विचार क्यों?
क्या यह रूट डिवाइस से संबंधित हो सकता है?
संबंधित एक्सएमएल दृश्य:
<com.package.name
android:id="@+id/scene"
android:onClick="startx"
style="@style/txt_money_style"
android:layout_width="72dp"
android:layout_height="72dp"
android:background="@drawable/wtbtn"
android:layout_gravity="right"
android:gravity="center_vertical|right"
/>
मुझे पूरा यकीन है कि इसे कॉल किया जाता है और यह कि एंड्रॉइड में गलती नहीं है। हमने कस्टम दृश्यों के आधार पर पूरी तरह से एक ऐप बनाया और 5.0.2 पर कोई समस्या नहीं थी। शायद यह आपके डिवाइस/कस्टम रोम या आपके कोड के साथ एक मुद्दा है। –
अनुमान लगाया गया है: आपका दृश्य दृश्यमान नहीं है, और एक नया अनुकूलन है जो वास्तव में आवश्यक होने पर ऐसे विचारों के निर्माण को रोकता है। – yoah
क्या आप 5.0.2 में स्क्रीन पर यह दृश्य देखते हैं? –