LilMoke
LilMoke

Reputation: 3454

Android App Gradient Background

I am developing an Android app using MonoDevelop and I have a table with 12 ImageButtons that are 48x48. The table is centered in the android screen. I cannot figure out how to put a gradient background, or any background, behind the table.

Is it possible to place a view behind the table or maybe I should be using a different control other than a table.... maybe a GridView?

Can anyone point me in the right direction?

Thanks for the help!!

Upvotes: 0

Views: 3468

Answers (1)

Ivozor
Ivozor

Reputation: 976

Have you tried one of the following in you Table Layout?

XML:

android:background="@drawable/cool_gradient"

In code:

tableLayout.SetBackgroundResource(Resource.Drawable.cool_gradient);

Where "cool_gradient" is a .xml file with your gradient in your "Resources/Drawable" folder. Example:

<?xml version="1.0" encoding="utf-8" ?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient 
        android:startColor="#E8E8E8" 
        android:endColor="#BEBEBE"
        android:angle="270"
     />
</shape>

Upvotes: 1

Related Questions