Answer the question
In order to leave comments, you need to log in
How to programmatically customize the appearance of a widget?
I have a widget:
Markup:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_margin="2dip"
android:background="@drawable/widget"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dip"
android:layout_marginRight="3dip"
android:layout_marginTop="3dip"
tools:ignore="UseCompoundDrawables" >
<TextView
android:id="@+id/widget_title"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/edit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="1dip"
android:contentDescription="@string/edit"
android:src="@drawable/widget_edit" />
</LinearLayout>
<TextView
android:id="@+id/widget_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip" />
</LinearLayout>
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#FFFFFFFF" />
<solid android:color="#00000000"/>
<corners
android:bottomLeftRadius="7dp"
android:bottomRightRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
</shape>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question