I need to show border around TableRow
in TableLayout
.
How would i do that???
This example demonstrates how create a table with borders in Android . Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.
To add a border to Android TextView we need to create an XML containing shape as a rectangle file under the drawable's folder and set it as background to the TextView. <stroke> tag is used to set the border width and color.
android.widget.TableRow. A layout that arranges its children horizontally. A TableRow should always be used as a child of a TableLayout . If a TableRow's parent is not a TableLayout, the TableRow will behave as an horizontal LinearLayout .
I give one idea -> Create one xml file using shape tag
like this
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF"/>
<stroke android:width="2dp" android:color="#515151"/>
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="5dp"
android:right="10dp" android:bottom="5dp" />
</shape>
set this xml file in android:background="@drawable/xmlFilename" of your table layout
it gives the border around your tablelayout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With