开发者

Problem with Android Layout

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"/>

    开发者_C百科<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>


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜