Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android table with round border

How can I make a table with a round border, similar to the photo below, in Android?

Round-bordered table

like image 853
Gerardo Avatar asked Mar 05 '10 13:03

Gerardo


People also ask

How can I create a table with borders 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 make a linear layout round?

Here's What To Do:Create a rounded shape drawable and set it as your view's background: android:background="@drawable/round_outline" Clip to outline in code: setClipToOutline(true)


1 Answers

I think Androidbase linked to the wrong question... he asked a similar question recently, and here's the answer I gave him:

You can put a coloured background with rounded corners into a table by using a Shape background. Create such a shape in an XML file, put in your drawables folder.

<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android">     <solid android:color="#99FFFFFF"/>     <corners android:radius="30px"/>     <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />  </shape> 

For example the above creates a semi-transparent white background with 30px rounded corners. You set this to the table by using

android:background="@drawable/my_shape_file" 

in the XML file where you defined your table layout.

like image 128
Steve Haley Avatar answered Oct 24 '22 10:10

Steve Haley