Triangular shaped button for android activity

不羁岁月 提交于 2019-12-04 09:58:27
sherin

Try this for triangle shape: call it as a background for your textview or any.

triangle.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
   <item>
      <rotate
        android:fromDegrees="45"
        android:toDegrees="45"
        android:pivotX="-40%"
        android:pivotY="100%"
        >
           <shape android:shape="rectangle">

              <corners android:radius="15dip" />
              <solid android:color="@color/blue" />
           </shape>
      </rotate>
   </item>
</layer-list>

//TEXTVIEW CALLING

<TextView
  android:layout_width="@dimen/triangle"
  android:layout_height="@dimen/triangle"
  android:rotation="90"
  android:layout_centerVertical="true"
  android:background="@drawable/triangle"/>
Vikram Singh

Check this answer of mine, i think you can follow this approach to achieve your goal.. [How to make ImageButtons bounds wrap around the image?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!