How to create ring shape drawable in android?

2dp outer ring with a 2dp gap: <?xml version=”1.0″ encoding=”utf-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:top=”4dp” android:right=”4dp” android:bottom=”4dp” android:left=”4dp”> <shape android:shape=”oval”> <solid android:color=”#4d4d4d” /> </shape> </item> <item> <shape android:shape=”oval”> <stroke android:width=”2dp” android:color=”#4d4d4d”/> </shape> </item> </layer-list>

Creating a rectangle shape with only two rounded edges

<shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle” android:padding=”10dp”> <solid android:color=”#FFFFFF”/> <corners android:bottomRightRadius=”0dp” android:bottomLeftRadius=”0dp” android:topLeftRadius=”15dp” android:topRightRadius=”15dp”/> </shape> This code is just working (since?) Android version 2.2. Referring to the documentation, the code should look like the following: <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle” android:padding=”10dp”> <solid android:color=”#FFFFFF”/> <corners android:radius=”2dp” android:bottomRightRadius=”0dp” android:bottomLeftRadius=”0dp” android:topLeftRadius=”15dp” android:topRightRadius=”15dp”/> </shape>

How to create a semi transparent shape?

The image below illustrates transparency using OpenCV. You need to do an alpha blend between the image and the rectangle. Below is the code for one way to do this. #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> int main( int argc, char** argv ) { cv::Mat image = cv::imread(“IMG_2083s.png”); cv::Mat roi = image(cv::Rect(100, 100, 300, 300)); cv::Mat color(roi.size(), … Read more

Android: How can I use the layer-list and shape elements to draw a horizontal rule when set as background?

Found the answer before i’d finished asking about it. <?xml version=”1.0″ encoding=”utf-8″?> <layer-list xmlns:android=”http://schemas.android.com/apk/res/android” > <item> <shape android:shape=”rectangle”> <stroke android:width=”1dp” android:color=”@color/hr_bottom” /> <solid android:color=”#00FF0000″ /> <padding android:bottom=”1dp”/> </shape> </item> <item> <shape android:shape=”rectangle”> <stroke android:width=”1dp” android:color=”@color/hr_top” /> <solid android:color=”#00FF0000″ /> <padding android:bottom=”1dp”/> </shape> </item> <item> <shape android:shape=”rectangle”> <stroke android:width=”1dp” android:color=”#00000000″ /> <solid android:color=”#00000000″ /> </shape> </item> … Read more

Half circle shape not work

you can try this : <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle”> <solid android:color=”#900021df”/> <size android:width=”10dp” android:height=”5dp”/> <corners android:bottomLeftRadius=”20dp” android:bottomRightRadius=”20dp”/> </shape> it gives this shape:

How do I draw lines using XNA?

When working with XNA, everything (even 2d primitives) have to be expressed in a way that a 3d card can understand, which means that a line is just a set of vertices. MSDN has a pretty good walkthrough here: http://msdn.microsoft.com/en-us/library/bb196414.aspx#ID2EEF You’ll find that it takes more code to render a primitive line than it would … Read more