How to draw a line with curved ends


Sheikh

ow

How can I draw the horizontal line shown in the image above (curved upwards from the left end) in the XML file through the selector? Below is my selector file code. thanks

<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dip" android:color="@color/md_black_1000" />
<solid

    android:color="#ffffff"
    />
<corners
    android:topLeftRadius="15px"
    android:bottomLeftRadius="15px"
    />

<padding
    android:top="3dp"
    android:bottom="3dp"
    />
</shape>
Bracadabra

I believe you can only achieve this effect in specific cases, for example when you fix the item height as:

<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
    android:insetTop="-2dp"
    android:insetRight="-2dp">
    <shape>
        <corners android:bottomLeftRadius="80dp" />
        <stroke android:width="2dp" />
    </shape>
</inset>

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:text="Item"
        android:gravity="center_vertical"
        android:paddingLeft="16dp"
        android:paddingRight="16dp"
        android:background="@drawable/selector"/>

</FrameLayout>

Adhesion:

enter image description here

Related


How to draw a line with curved ends

Sheikh How can I draw the horizontal line shown in the image above (curved upwards from the left end) in the XML file through the selector? Below is my selector file code. thanks <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.andro

How to draw a line with curved ends

Sheikh How can I draw the horizontal line shown in the image above (curved upwards from the left end) in the XML file through the selector? Below is my selector file code. thanks <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.andro

How to draw a line with curved ends

Sheikh How can I draw the horizontal line shown in the image above (curved upwards from the left end) in the XML file through the selector? Below is my selector file code. thanks <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.andro

How to draw circle line ends using Matplotlib

Atomic 33ls Suppose I'm plotting complex values like this: a=-0.49+1j*1.14 plt.polar([0,angle(x)],[0,abs(x)],linewidth=5) give Is there a setting I can use to get the ends of rounded lines, such as the red line (drawn with paint) in the example below? tacaswe

How to draw circle line ends using Matplotlib

Atomic 33ls Suppose I'm plotting complex values like this: a=-0.49+1j*1.14 plt.polar([0,angle(x)],[0,abs(x)],linewidth=5) give Is there a setting I can use to get the ends of rounded lines, such as the red line (drawn with paint) in the example below? tacaswe

How to draw circle line ends using Matplotlib

Atomic 33ls Suppose I'm plotting complex values like this: a=-0.49+1j*1.14 plt.polar([0,angle(x)],[0,abs(x)],linewidth=5) give Is there a setting I can use to get the ends of rounded lines, such as the red line (drawn with paint) in the example below? tacaswe

How to draw circle line ends using Matplotlib

Atomic 33ls Suppose I'm plotting complex values like this: a=-0.49+1j*1.14 plt.polar([0,angle(x)],[0,abs(x)],linewidth=5) give Is there a setting I can use to get the ends of rounded lines, such as the red line (drawn with paint) in the example below? tacaswe

How to draw curved shadows?

Ilutov like this: I know this doesn't work NSShadow, drawRect:plugging it in does the trick. David Rönnqvist You can use Core Animations layers and shadowPathproperties to do this and many other types of shadows . The shadow you describe can be generated by an

How to draw "curved" lines?

Daniel The problem is simple, as the title says. Tizen's documentation is really unreliable on this topic (among others). For example, as they describe here : Draw SVG paths. You can use the api in efl_gfx_utils.h to construct the path ... efl_gfx_path_append_

How to draw "curved" lines?

Daniel The problem is simple, as the title says. Tizen's documentation is really unreliable on this topic (among others). For example, as they describe here : Draw SVG paths. You can use the api in efl_gfx_utils.h to construct the path ... efl_gfx_path_append_

How to draw a curved line (peak) using a list of x,y coordinates

Ballarat 26 I have a printed list of x,y points showing an uneven peak curve. The above image is generated by painting the dots on the Java paint component. I use the following method to draw them on the paint component. g.drawline(pointX,pointY,pointX,pointY)

Draw a line with curved edges in Android

user2726456: I canvas.drawLineuse to draw lines in android, but the lines are too sharp, but I need curved edges Here 1 is what I have and 2 is what I want to achieve, meaning a line is curved instead of straight How can I achieve this? Edit 2: I am trying to

Draw a line with curved edges in Android

username i canvas.drawLineuse to draw lines in android but the lines are too sharp but i need curved edges Here 1 is what I have and 2 is what I want to achieve, meaning a line is curved instead of straight How can I achieve this? Edit 2: I am trying to draw a

Draw a line with curved edges in Android

user2726456: I canvas.drawLineuse to draw lines in android, but the lines are too sharp, but I need curved edges Here 1 is what I have and 2 is what I want to achieve, meaning a line is curved instead of straight How can I achieve this? Edit 2: I am trying to

Draw a line with curved edges in Android

user2726456: I canvas.drawLineuse to draw lines in android, but the lines are too sharp, but I need curved edges Here 1 is what I have and 2 is what I want to achieve, meaning a line is curved instead of straight How can I achieve this? Edit 2: I am trying to

How to draw curved SVG paths

Raphael How would I (if possible) draw a black border only along the inside of this svg. I've tried strokes and adding the stroke width, but this wraps the whole svg. Is there a way to stop the stroke at a specific point? div{ width: 300px; margin: 0 auto;

How to draw curved SVG paths

Raphael How would I (if possible) draw a black border only along the inside of this svg. I've tried strokes and adding the stroke width, but this wraps the whole svg. Is there a way to stop the stroke at a specific point? div{ width: 300px; margin: 0 auto;

How to draw curved arrows with CreateJS?

graphics problem The JavaScript code for drawing the curved arrow is already in this fiddle : http://jsfiddle.net/SguzM/ I want to do the same thing using CreateJS library. The fiddle code above is as follows: var can = document.getElementById('canvas1'); var

How to draw curved arrows with CreateJS?

graphics problem The JavaScript code for drawing the curved arrow is already in this fiddle : http://jsfiddle.net/SguzM/ I want to do the same thing using CreateJS library. The code from the fiddle above is as follows: var can = document.getElementById('canvas

How to draw curved SVG paths

Raphael How would I (if possible) draw a black border only along the inside of this svg. I've tried strokes and adding the stroke width, but this wraps the whole svg. Is there a way to stop the stroke at a specific point? div{ width: 300px; margin: 0 auto;

How to draw curved arrows with CreateJS?

graphics problem The JavaScript code for drawing the curved arrow is already in this fiddle : http://jsfiddle.net/SguzM/ I want to do the same thing using CreateJS library. The code from the fiddle above is as follows: var can = document.getElementById('canvas

Draw line offset at both ends

Kakarot I am trying to draw a dashed line using that DrawLinemethod . However, it offsets the ends slightly, making the lines unsightly. How can I prevent the offset from increasing at both ends? protected override void OnPaint (PaintEventArgs e) { Graphics

How to draw a curved (interpolated) line point by point using D3?

Jonas I'm trying to implement a horse race-like activity ( https://app.flourish.studio/@flourish/horserace ). But I want to do it with curves. My idea is to draw the line point by point and do some extra processing when a new point is reached. The problem is t

How to draw curved SVG with single path?

Weber What I want is in the image below - I have 3 relative questions about this 1. We can use single path. Paint the entire canvas ? 2. If we can only use multiple paths to draw the whole, will it be convenient to animate them? 3. In both cases, who can kindl

How to draw curved text using MFC functions?

user How to draw curved text using MFC functions? I want to achieve something like this below. The DrawText() function only draws text on straight lines, I don't know how to draw curved text at a specific angle. please help me. thanks. Derry Wu - MSFT You can

ThreeJS how to draw shapes with curved edges

geoffs3310 I'm trying to make a shape using threeJS consisting of straight and curved edges. Currently I have the following: I want the two top corners to be joined by a semicircle so it ends up being a square with a semicircle cut out from the top like so: wh

How to draw arcs with curved edges in iOS?

Ballas In one of my applications I am trying to draw gradient arcs with rounded corners. As shown below. This is what I have done so far with the following code. -(void)startArc { UIBezierPath *roundedArc = [self arcWithRoundedCornerAt:centerPoint startAn

How to draw curved SVG with single path?

Weber What I want is in the image below - I have 3 relative questions about this 1. We can use single path. Paint the entire canvas ? 2. If we can only use multiple paths to draw the whole, will it be convenient to animate them? 3. In both cases, who can kindl

How to draw curved SVG with single path?

Weber What I want is in the image below - I have 3 relative questions about this 1. We can use single path. Paint the entire canvas ? 2. If we can only use multiple paths to draw the whole, will it be convenient to animate them? 3. In both cases, who can kindl