-1

The problem is my drawable background is not showing as android Designer

my project contain this

         <TextView
            android:id="@+id/BloodType"
            android:layout_width="40px"
            android:layout_height="40px"
            android:background="@drawable/circle"
            android:gravity="center"
            android:textIsSelectable="false"
            android:textColor="#ffffff" />

and this is circle.mxl

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient
    android:endColor="#ffffff"
    android:gradientRadius="10"
    android:startColor="#ff0522"
    android:type="radial"></gradient>
<stroke
    android:width="1dp"
    android:color="#000000"></stroke>

can any one Help me because I'am new to android devolopment

this image showing the difference between designer and real running and may show problem if you cant understand me

thanxx advance ...

jemystack
  • 408
  • 7
  • 12

2 Answers2

0

You have oval shape drawable, and setting this drawable with a textview which has equal height and width. So it behave's like a circle.

See here : How can I draw circle through XML Drawable - Android?

Community
  • 1
  • 1
Sabari
  • 1,963
  • 1
  • 13
  • 10
0

i have solved my problem by make it proggramaticlly thanks for you

Like this

 GradientDrawable g = new GradientDrawable(
            GradientDrawable.Orientation.TL_BR, new int[]{Color.rgb(255, 10, 40), Color.WHITE});
    g.setStroke(1, Color.BLACK);
    g.setShape(g.OVAL);
    g.setGradientType(GradientDrawable.LINEAR_GRADIENT);
    g.setGradientRadius(X);
    View.setBackground(g);
jemystack
  • 408
  • 7
  • 12