Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to give border for tablerow in tablelayout in android?

I need to show border around TableRow in TableLayout.

How would i do that???

like image 719
Sourabh Avatar asked Apr 06 '11 06:04

Sourabh


People also ask

How to set border for TableLayout in Android?

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.

How do you put a border on Android?

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.

What is table row in Android Studio?

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 .


1 Answers

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

like image 150
Ayudh Avatar answered Sep 20 '22 21:09

Ayudh