(मेरा पूरा विजेट लेआउट का हिस्सा)विजेट लेआउट पृष्ठभूमि बदलने के लिए प्रोग्राम के
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/widget_background_dark_4x2"
android:orientation="horizontal"
android:id="@+id/widget_main"
>
मैं पृष्ठभूमि इस्तेमाल किया drawable एक उपयोगकर्ता चयन के आधार पर बदलने के लिए सक्षम होना चाहते हैं, उदाहरण के लिए इस विजेट लेआउट है। हालांकि मैं इसे अपने रैखिक लेआउट की पृष्ठभूमि के लिए एक ही करने के लिए मुश्किल लग गया है
remoteView.setTextColor(R.id.text_view1, Color.WHITE);
: दूरस्थ विचारों का उपयोग उदाहरण के लिए मैं कुछ इस तरह कर रही द्वारा एक TextView का रंग बदल सकते हैं। मैं यह कोशिश की थी:
remoteView.setBitmap(R.id.widget_main, "setBackgroundDrawable", ((BitmapDrawable) context.getResources().getDrawable(R.drawable.widget_background_dark_4x2)).getBitmap());
लेकिन मैं निम्नलिखित त्रुटि मिलती है:
06-01 22:46:36.305: WARN/AppWidgetHostView(244): android.widget.RemoteViews$ActionException: view: android.widget.LinearLayout doesn't have method: setBackgroundDrawable(android.graphics.Bitmap)
किसी भी मदद के इस के साथ बहुत सराहना की जाएगी।
< < संपादित करें >> भी इस की कोशिश की है:
06-01 23:11:26.039: WARN/AppWidgetHostView(244): updateAppWidget couldn't find any view, using error view 06-01 23:11:26.039: WARN/AppWidgetHostView(244): android.widget.RemoteViews$ActionException: view: android.widget.LinearLayout doesn't have method: setBackgroundDrawable(android.graphics.Bitmap)
यह उपयोगी है .. – Fon