stoic
stoic

Reputation: 4830

Android Shape containing multiple elements

How would one go about drawing a shape, then adding multiple elements to it?

At first I thought I should make use of either a textview, or a button, then simply apply a rectangle as a background. The problem with that is my text is all the same size.

I would also like to eventually add an image to the below purple button.

My end result should look like this:

android container

What would be very nice, is if there was some sort of container that one could use... unfortunately I am new to android, so I do not know what to search for.

Upvotes: 0

Views: 150

Answers (2)

wkarl
wkarl

Reputation: 809

Just use a LinearLayout and put two TextViews in it:

<LinearLayout
 android:orientation="vertical"
 android:height="wrap_content"
 android:width="wrap_content"
 android:padding="20dp">
    <TextView 
     android:text="123,150"
     android:width="wrap_content"
     android:height="wrap_content" />
    <TextView 
     android:text="TOTAL PAGE VIEWS"
     android:width="wrap_content"
     android:height="wrap_content" />
</LinearLayout>

This is an untested example to give you something to start with, you'll have to adjust font size/color and background yourself.

Upvotes: 1

Jerome B.
Jerome B.

Reputation: 244

you should look for a layout combinaison :

FrameLayout to have layout superposition

RelativeLayout to position items

Upvotes: 1

Related Questions