On Sep 3, 7:49 am, Meena Rengarajan <meenasoft...@gmail.com> wrote: > <?xml version="1.0" encoding="utf-8"?> > <shape xmlns:android="http://schemas.android.com/apk/res/android" > > android:shape="Rectangle"> > <gradient > android:startColor="#F778A1" > android:endColor="#D4A017" > android:angle="180"/> > <corners android:radius="60dp"/> > <padding android:left="9dp" > android:top="9dp" > android:right="9dp" > android:bottom="9dp" /> > <corners android:radius="90dp" /> > </shape> > > My Requirement : How to change the shape of the textview and buttons as a > Hexagonal shape? > > I have done so far :- > > This is my Code, I have changed textview shape as a rectangle with round > edged corners. But i have done this in Xml. It works fine for me. > > Same, now i wanna change the shape of the Textview as a Hexagonal shape so > textview label and button labels would be appeared in Hexagonal shape so i > wanna do this in my app. How could i do this ? Could anyone help me. > > Any suggestions / helps would be greatly appreciated, thank you >
if you really want to use hexagonal Shape this can be starting point: /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv = (TextView) findViewById(R.id.text); Path path = new Path(); float stdW = 100; float stdH = 100; float w3 = stdW / 3; float h2 = stdH / 2; path.moveTo(0, h2); h2 -= 6 / 2; path.rLineTo(w3, -h2); path.rLineTo(w3, 0); path.rLineTo(w3, h2); path.rLineTo(-w3, h2); path.rLineTo(-w3, 0); path.rLineTo(-w3, -h2); Shape s = new PathShape(path, stdW, stdH); ShapeDrawable d = new ShapeDrawable(s); Paint p = d.getPaint(); p.setColor(0xffeeeeee); p.setStyle(Style.STROKE); p.setStrokeWidth(6); tv.setBackgroundDrawable(d); } pskink -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en