How can I create a shape in android like the image I added?


Aksukumar Maldeh

Can anyone tell me how to create a shape that is somewhat rectangular but ends up being a triangle.

enter image description here

Jack'

I would use the gradient image from the drawable folder. Let's call it background.png. You can also do it with the icons searchicon.png and arrow.png

Then I will use the following code:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:background="@drawable/background">
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:gravity="center_vertical">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#ffffff"
            android:layout_marginBottom="10dp"
            android:text="Current Location"/>
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:textColor="#ffffff"
                android:textSize="20dp"
                android:text="Mumbai"/>
            <ImageView
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:src="@drawable/arrow"/>
        </LinearLayout>
    </LinearLayout>
    <ImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_marginRight="50dp"
        android:layout_marginEnd="50dp"
        android:layout_centerVertical="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:src="@drawable/searchicon"/>
</RelativeLayout>

Related


How can I create a shape in android like the image I added?

Aksukumar Maldeh Can anyone tell me how to create a shape that is somewhat rectangular but ends up being a triangle. Jack' I would use the gradient image from the drawable folder. Let's call it background.png. You can also do it with the icons searchicon.png a

How can I create a layout like in the image?

icosahedron I want an image like this but when the texts are not of equal length the distance between the TextViews changes and when there are too many words go to the next line. The xml code for the layout I created is: <?xml version="1.0" encoding="utf-8"?>

How can I create a custom shape that can display an image?

Ashish Tiwari In a project I have to display contour plots and other images with different shapes . I don't know how to create such a shape, and how to display an image in it. I also have to place this shape in the list view. Please give me advice. Thanks in a

How can I create such a shape?

Rudy How can I create this with css? thank you for your help. What I have tried: .box { background: purple; padding: 20px; clip-path: polygon( 70% 100%, 100% calc(100% - 3vw), 100% 0, 0 0, 0 calc(100% - 3vw) ); } <div class="box"></

How can I create this specific shape using xml in android?

Mohammad Nouri I want to create a shape like the picture below, but i want to create this with xml code (while drawing), i don't want to create this picture with 9.patch ! How can I create this shape using xml code? johnrao07 Here is a workaround <shape xmlns:

How can i create a div shape like i have shared 100% width

username I want to create a divfigure with the above shape and I want it to have a width of 100%. Below is the HTML and CSS I have tried. I can make a triangle, but not with 100% width div: HTML: <div class="triangle-up"><div></div></div> CSS: .triangle-up {

How can i create a div shape like i have shared 100% width

username I want to create a divfigure with the above shape and I want it to have a width of 100%. Below is the HTML and CSS I have tried. I can make a triangle, but not with 100% width div: HTML: <div class="triangle-up"><div></div></div> CSS: .triangle-up {

How can i create a second image instead of filling like words

Kady I have the code below. I use this to use 1 image and use the "rel" and "title" tags to fill in the words to display with the actual image. This will create a banner-like system that uses text instead of all images. Right now, what I'm trying to do is popu

How can I create a plist like the image below?

Navier I am trying to create a plist with the following functionality. Inside the plist there are two keys 1.id 2.status The current value is id: 91 status: buy where the id should be unique. If I try to add a third entry like id:91 status:downlaod it should r

How can I create a color combination like an attached image?

Knicks 290192 I want to create background in Xcode like attached image. Any suggestions? swift boy The best way is to always use Image as background let navBackgroundImage:UIImage! = UIImage(named: "your_background_image_name_here") If you just want to set th

How can i create a second image instead of filling like words

Kady I have the code below. I use this to use 1 image and use the "rel" and "title" tags to fill in the words to display with the actual image. This will create a banner-like system that uses text instead of all images. Right now, what I'm trying to do is popu

How can I create a plist like the image below?

Navier I am trying to create a plist with the following functionality. Inside the plist there are two keys 1.id 2.status The current value is id: 91 status: buy where the id should be unique. If I try to add a third entry like id:91 status:downlaod it should r

How can i create a second image instead of filling like words

Kady I have the code below. I use this to use 1 image and use the "rel" and "title" tags to fill in the words to display with the actual image. This will create a banner-like system that uses text instead of all images. Right now, what I'm trying to do is popu

How can I create this shape in SVG?

Rahul Desai Now, I use an ellipse to set the base of the bars to be shaded. : http://jsfiddle.net/rdesai/MjFgK/55/ _ _ How can I change the style so that the base is as shown in the table below? edit The problem can be reduced to creating a shape like this: I

How can I create this shape in SVG?

Rahul Desai Now, I use an ellipse to set the base of my bars to be shaded. : http://jsfiddle.net/rdesai/MjFgK/55/ _ _ How can I change the style so that the base is as shown in the table below? edit The problem can be reduced to creating a shape like this: I c

How can I create this shape in Flutter?

Anas Ressa Please can anyone help me to create this shape in the top right corner of my phone screen: Thanks in advance. Jaime Ortiz You can use the Stack widget and it's child widgets, it has a container with a circle, after which you can push the circle off

How can I create this shape in SVG?

Rahul Desai Now, I use an ellipse to set the base of my bars to be shaded. : http://jsfiddle.net/rdesai/MjFgK/55/ _ _ How can I change the style so that the base is as shown in the table below? edit The problem can be reduced to creating a shape like this: I c

How can i make a menu like below image in android

You can be young: How to create a shortcut pinned like this , so when the app launches the logo, the user taps long to create a shortcut to navigate to a certain activity, eg: 1: Record voice note 2: Type note 3: ... It is better to use java. Alexander Hoffman

How can i make a menu like below image in android

You can be young: How to create a shortcut pinned like this , so when the app launches the logo, the user taps long to create a shortcut to navigate to a certain activity, eg: 1: Record voice note 2: Type note 3: ... It is better to use java. Alexander Hoffman

How can i create a swipe button like Uber android app

Rakesh Kumar Hi all I am instructing me how to create Uber bottom button in android. Any sample code or code suggestions. Uber bottom button to select car type button Gjson Use android ui widgets seekbar. and customize your style.

How can i create a swipe button like Uber android app

Rakesh Kumar Hi all I am instructing me how to create Uber bottom button in android. Any sample code or code suggestions. Uber bottom button to select car type button Gjson Use android ui widgets seekbar. and customize your style.

How can i create a loop bar like below in android

indecisive Progressbar example in an android app. How can i create loop bar like below in android. Andy I think a similar question has been answered here: How to customize a progress bar in Android , you can find more styles here: Android Arsenal

How can i create a loop bar like below in android

indecisive Progressbar example in an android app. How can i create loop bar like below in android. Andy I think a similar question has been answered here: How to customize a progress bar in Android , you can find more styles here: Android Arsenal

How can I fit the image to the shape of this PNG image in CSS?

Ryan. How can I put an image on this png image but keep the shape? in CSS? I've seen that there are some ways to do this using SVG clip paths, but I'm wondering if there's a faster way to just set it as a background image or something? Thanks and sorry if this

How can i create a figure like this

Ilushahot Do I want to create such a graph using CSS? I browsed and found rectangles, ovals, but haven't come across them yet. picture: Accompanying Afif A skew transform can do this: .box { height: 400px; width: 400px; position: relative; border-left: