• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps TableLayout issue using images

rick99gtp

Newbie
Hello,

So, I'm trying to learn how to create different layouts and truly understand how to use them. What I'm trying to accomplish is a simple header image at the top of the screen, followed by 2 views (an imageview and a textview), equally spaced below that.

So, I figured I'd put an ImageView for the header image. Below that, I created a TableLayout with one row, with an ImageView in the 1st column and a TextView in the 2nd column.

I have a couple of questions:

1. Is this the best way to do this?
2. How do I know how big to make the images (in Photoshop or other graphics program)

Here is my xml code. Any help would be greatly appreciated, as always! :)

Code:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">


		<ImageView
			android:src="@drawable/logoheader"
			android:id="@+id/logoheader"
			android:layout_width="fill_parent"
			android:layout_height="wrap_content" />
			
        <TableLayout 
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
                android:stretchcolumns="0, 1"

                <TableRow>

                        <ImageView 
                                android:id="@+id/nochances"
                                android:src="@drawable/nochances"
                                android:layout_height="wrap_content" 
                                android:layout_width="wrap_content" /> 
  
                        <TextView 
                                android:id="@+id/score" 
                                android:layout_height="wrap_content" 
                                android:layout_width="wrap_content" 
                                android:text="Score:" />

                </TableRow>

        </TableLayout>

</LinearLayout>
 
Back
Top Bottom