views:

155

answers:

1

I'm having a very hard time getting the 2 buttons in the 2nd child linearlayout to display as I want them to... I want them centered, on the same row but they appear left-aligned and on the same row. Can anyone help me with this?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/black"
    android:orientation="vertical">

  <LinearLayout
      android:id="@+id/splash"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical">

    <ImageView
      android:id="@+id/imageLogo1"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:adjustViewBounds="true"
      android:cropToPadding="true"
      android:scaleType="fitXY"
      android:src="@drawable/isi_logo"
      android:paddingLeft="50sp"
      android:paddingRight="50sp"
      android:paddingTop="20sp"/>

    <ImageView
      android:id="@+id/imageLogo2"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:adjustViewBounds="true"
      android:cropToPadding="true"
      android:scaleType="fitXY"
      android:src="@drawable/sa_logo"
      android:paddingLeft="100sp"
      android:paddingRight="100sp"
      android:paddingBottom="20sp"/>

  </LinearLayout>

  <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_gravity="center">

    <Button  
      android:id="@+id/buttonScores"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:width="100sp"
      android:text="@string/scores"/>

    <Button
      android:id="@+id/buttonStart"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:width="100sp"
      android:text="@string/test"/>

  </LinearLayout>

</LinearLayout>
+2  A: 

Try using android:gravity="center" instead of android:layout_gravity="center"

skyman
+1 yea, that did the trick. Still learning this android layout stuff. It's like learning html and css all over again. Thanks
Ryan