Skip to content

Instantly share code, notes, and snippets.

@csdear
Created March 6, 2014 16:58
Show Gist options
  • Select an option

  • Save csdear/0062abd2e7217d75c3aa to your computer and use it in GitHub Desktop.

Select an option

Save csdear/0062abd2e7217d75c3aa to your computer and use it in GitHub Desktop.
Drawable : Simple ShapeDrawable XML
package course.examples.Graphics.ShapeDrawXML;
import android.app.Activity;
import android.os.Bundle;
public class ShapeDrawActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
=========================
// xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_window"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:contentDescription="@string/cyan_circle"
android:padding="20dp"
android:src="@drawable/cyan_shape" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="@string/magenta_circle"
android:padding="20dp"
android:src="@drawable/magenta_shape" />
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment