how to make a capsule shape Button in android?

how to make a capsule shape Button in android?

By : clindh
Date : November 19 2020, 01:01 AM
it fixes the issue finally I found the way to do it with xml file. here is the code of the xml file that gave me the capsule shape button.
code :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

    android:topRightRadius="30dp" />

  <solid android:color="#CFCFCF" />

    android:top="0dp" />

    android:width="270dp" />


Share : facebook icon twitter icon
Shape casting a capsule against convex polyhedra

Shape casting a capsule against convex polyhedra

By : user3441685
Date : March 29 2020, 07:55 AM
this one helps. Since you are considering capsules and convex polyhedra, I suppose you could use something based on GJK. You would get the point of contact and a surface normal during a collision, and the minimum distance between the objects and the associated witness points if there is no collision.
You can also take a look at this publication on Interactive and Continuous Collision Detection for Avatars in Virtual Environments.
Android: Make a button with triangle shape using xml definitions (drawable)

Android: Make a button with triangle shape using xml definitions (drawable)

By : user3111570
Date : March 29 2020, 07:55 AM
To fix this issue I want create this using button (TextView) by using XML definiton: , If someone still has issues with this :
code :
<item android:top="45dp">
        <size android:height="100dp" android:width="90dp"/>
        <solid android:color="@android:color/holo_orange_light" />
<item android:top="36dp" android:left="11dp">
        android:pivotY="20%" >
            <size android:width="40dp"
            <stroke android:color="@android:color/holo_orange_light" android:width="1dp"/>
            <solid android:color="@android:color/holo_orange_light" />
public class CustomTextView extends TextView {

    private int mWidth;
    private int mHeight;

    public CustomTextView(Context context, AttributeSet attrs)  {
        super(context, attrs);


    protected void onDraw(Canvas canvas) {

        Paint mPaint = new Paint();
        int color = getResources().getColor(R.color.YourColor);

        Path mPath = new Path();
        mPath.moveTo(.0f, this.getHeight());
        mPath.lineTo(0.8f * this.getWidth(), this.getHeight());
        mPath.lineTo(this.getWidth(), 0.5f * this.getHeight());
        mPath.lineTo(0.8f * this.getWidth(), .0f);
        mPath.lineTo(.0f, .0f);
        mPath.lineTo(.0f, this.getHeight());


I would like to make a button selected using selector item with shape in android

I would like to make a button selected using selector item with shape in android

By : user3330984
Date : March 29 2020, 07:55 AM
around this issue I have defined button style using selector with shape and kept the same in the drawable folder. Then attached it with the buttons in a layout file. , Add following code in .java file
code :
Button btn =(Button) findViewById(R.id.btnLevel1);
btn.setOnClickListener(new View.OnClickListener() {
  public void onClick(View v) {
    // code here 
How to make a button of this shape in android?

How to make a button of this shape in android?

By : Amjad Ali
Date : March 29 2020, 07:55 AM
help you fix your problem Use that xml fileinside Drawable folder and assign it to TextView as android:background="@drawable/xmlFile"
code :
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"

        android:color="#FFF" />
        android:color="#F00" />
        android:bottom="5dip" />
How to do Capsule shape div with delimiter like below attachment?

How to do Capsule shape div with delimiter like below attachment?

By : vespula
Date : March 29 2020, 07:55 AM
like below fixes the issue Is it possible to make a capsule shape using border-radius without a set width or height and include between delimeter? , Yes, You can try this way
code :
.container {
    width: 90%;
    margin: 10px auto;
ul {
    list-style: none;
    padding: 7px;
    background: #333;
    border-radius: 12px;
    display: inline-flex;

li {
    padding: 0 10px;
    border-right: 1px solid #999;
    line-height: 1;
    color: #999;
    font-size: 12px;
    display: inline-block;
    vertical-align: middle;

li:last-child {
    border-right: none;
<div class="container">
Related Posts Related Posts :
  • Android Studio gradle build failed for hello world app
  • Slide a layout up from bottom of screen
  • Play HTML5 video in iOS/Android native media player
  • How to rescale a bitmap file in android?
  • No view found for id 0x for fragment after rotation?
  • Define different themable styles to the same widget types
  • ProGuard not working in my app
  • FragmentTransaction from BaseAdapter
  • Connecting multiple devices in a Wifi Direct group
  • Why TabActivity is deprecated in android
  • How to capture low resolution picture using android camera
  • android preferenceactivity padding in landscape orientation
  • How can I store cookie in webview?
  • Passing variables from one activity to another
  • Create Multicolored Pie Chart in Android Studio
  • how to kill progress dialog in android
  • Show Error on the tip of the Edit Text Android
  • How do I use getWindowManager() by another java file
  • fetching images from gallery on android phones with internal storage
  • How to discover devices like Google TV and Nexus-Q using MediaRoute API on Android?
  • "Unfortunately your app stopped working"- Facebook Integration for Android
  • How to animate button in android?
  • Resource Not Found Exception in class without context or activity
  • Launching Android Netflix App And Passing Video Id
  • Making a Phone Call with a Number Extension
  • NullPointerException at BoringLayout.isBoring is anything but boring
  • java.lang.RuntimeException: Unable to get provider
  • Testing custom Views with Robolectric
  • tools:listheader doesn't work although tools:listitem does
  • oppo, vivo app kill notification not coming in android fcm
  • OnClick Method could not function correctly with if else statement
  • Best method to download image from url in Android
  • How can I open Drawer Layout moving all the view and not just slide over?
  • how to show profile pictures of friends in a list view?
  • Creating TimePickerDialog with custom style in Android
  • Android 2.3.6 support library v7 option menu is missing
  • need of vblank in Display subssytem
  • Android MP4 stream - Video cannot be played
  • FastAdapter: Undo button does not show up after swipe
  • What are reasons to pass getActivity as the LifecycleOwner to the LiveData's observe method in a fragment?
  • Implement Face Recognition in Android
  • Titanium studio cannot run "titanium" command in terminal
  • How to execute command line ffmpeg commands programatically in android?
  • Make Android List Items clickable with each item pointing to a different link
  • listview runs successfully, but nothing is display in emulator
  • How to zoom in a bitmap with high resolution?
  • Passing listView data through intent
  • Google map route direction show by arrows in android v2
  • how to start "uiautomator test run" from android code?
  • Proguard in Android Library
  • Alarm Clock from GIT - Gives error - Android
  • Mock injection using Mockito - Android
  • Get Bitmap from universal image loader
  • Unable to include custom font in android
  • Basics on using logcat in Android development
  • Android: Clear cache programmatically
  • Android: pass object without serialization
  • Can not scroll and click item on gridview inside scrollview
  • Android device keeps disconnecting from adb / eclipse
  • Volley cannot create cache directory. Could not clean up file
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org