Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Owner and Founder. Opencart
Top Partners
In this blog, I will show you how to make different shapes in android.
The shape is the XML Element which is defined in XML. and must be the root element.
The file location is :
res/drawable/your_shape.xml The filename is used as the resource ID.
res/drawable/your_shape.xml
The values which define the type of shape,
"rectangle": A rectangle that fills the containing View. This is the default shape. "oval": An oval shape that fits the dimensions of the containing View. "line": A horizontal line that spans the width of the containing View. This shape requires the <stroke> element to define the width of the line. "ring": A ring shape.
"rectangle": A rectangle that fills the containing View. This is the default shape.
"rectangle":
"oval": An oval shape that fits the dimensions of the containing View.
"oval":
"line": A horizontal line that spans the width of the containing View. This shape requires the <stroke> element to define the width of the line.
"line":
"ring": A ring shape.
"ring":
In Java: R.drawable.your_shape In XML: @[package:]drawable/your_shape
R.drawable.your_shape
your_shape
@[package:]drawable/your_shape
Create the file named circuler_shape.xml <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="@color/md_red_600" /> <padding android:bottom="5dp" android:left="5dp" android:right="5dp" android:top="5dp" /> </shape> 12345678910 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="@color/md_red_600" /> <padding android:bottom="5dp" android:left="5dp" android:right="5dp" android:top="5dp" /></shape> and this XML layout applies to a Textview: <TextView android:id="@+id/sale" android:layout_width="35dp" android:layout_height="35dp" android:background="@drawable/circuler_shape" android:gravity="center" android:text="SALE" /> 1234567 <TextView android:id="@+id/sale" android:layout_width="35dp" android:layout_height="35dp" android:background="@drawable/circuler_shape" android:gravity="center" android:text="SALE" /> For programmatically: TextView saleTv = (TextView)findViewByID(R.id.sale); tv.setBackgroundResource(R.id.circuler_shape); 12 TextView saleTv = (TextView)findViewByID(R.id.sale);tv.setBackgroundResource(R.id.circuler_shape);
Create the file named circuler_shape.xml
and this XML layout applies to a Textview:
For programmatically:
Source:
https://developer.android.com/
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Osama
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.