<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#09C"
android:padding="@dimen/widget_margin">
<TextView
android:id="@+id/widget_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="8dp"
android:background="#09C"
android:contentDescription="@string/appwidget_text"
android:textColor="#ffffff"
android:textSize="24sp"
android:textStyle="bold|italic" />
</RelativeLayout>
public class AppWidget extends AppWidgetProvider {
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
int appWidgetId) {
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.app_widget);
views .setTextViewText("Chefirovka is a large village not far from Tula. The people who live in Chefirovka grow vegetables and various kinds of fruit. They have domestic animals: cows, pigs, sheep, goats and even horses. You can see poultry there — hens, cocks, ducks, geese and turkeys. So they try to have everything they need to live well.");
appWidgetManager.updateAppWidget(appWidgetId, views);
}
}