右下脚图标
res/drawable/shapecount.xml
<?xml version="1.0" encoding="utf-8"?><shape? ? xmlns:android="http://schemas.android.com/apk/res/android"? ? android:shape="rectangle">? <corners android:radius="20dp" ?/> ? ?? <solid android:color="#ff2233" /></shape>
res/layout/my_widget_layout.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout ?xmlns:android="http://schemas.android.com/apk/res/android"? ? android:orientation="vertical"? ? android:layout_width="wrap_content"? ? android:layout_height="wrap_content"><RelativeLayout? ? android:orientation="vertical"? ? android:background="@null"? ? android:id="@+id/rlayout"? ? android:layout_width="wrap_content"? ? android:layout_height="wrap_content" >? ? <ImageView ? ? ? ? ? ? android:id="@+id/icon"? ? ? ? ? ? android:src="@drawable/icon" ? ? ? ? ? ? android:layout_margin="0dp"? ? ? ? ? ? android:layout_height="wrap_content" ? ? ? ? ? ? android:layout_width="wrap_content"/>? ? <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"? ? ? ? android:text="50" android:textSize="9dp" android:textStyle="bold" ?? ? ? ? android:background="@drawable/shapecount"? ? ? ? android:textColor="#FFFFFF"? ? ? ? android:paddingLeft="3dp" android:paddingRight="3dp"? ? ? ? ? ? android:layout_margin="0dp"? ? ? ? android:layout_alignBottom="@+id/rlayout"? ? ? ? android:id="@+id/txtCount" /></RelativeLayout><TextView android:layout_width="wrap_content" android:layout_height="wrap_content"? ? android:text="My App Name" android:textSize="9dp" android:textStyle="bold" ?? ? android:background="@drawable/shapecount"? ? android:textColor="#FFFFFF"? ? android:paddingLeft="3dp" android:paddingRight="3dp"? ? ? ? android:layout_margin="0dp"? ? android:layout_alignBottom="@+id/rlayout"? ? android:id="@+id/txtAppName" />?</LinearLayout>
public class TestActivity extends Activity {? ? /** Called when the activity is first created. */? ? final Random gen = new Random();? ? @Override? ? public void onCreate(Bundle savedInstanceState) {? ? ? ? super.onCreate(savedInstanceState);? ? ? ? setContentView(R.layout.main);? ? ? ? final TextView t = (TextView) findViewById(R.id.txtCount);? ? ? ? Timer timer = new Timer();? ? ? ? timer.schedule(new TimerTask() {? ? ? ? ? ? @Override? ? ? ? ? ? public void run() { ? ? ? ? ? ? ? ? runOnUiThread(new Runnable() {? ? ? ? ? ? ? ? ? ? @Override? ? ? ? ? ? ? ? ? ? public void run() {? ? ? ? ? ? ? ? ? ? ? ? int a = gen.nextInt(20);? ? ? ? ? ? ? ? ? ? ? ? t.setText(Integer.toStringbackground-color: transparent; margin: 0px; color: