简体   繁体   中英

Android “Hello World” Layout Problem on Galaxy Tab Screen

Hi guys :)
I'm trying to run a simple "Hello World" program with a button and a textview. This is the layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/layout"
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical" >
    <TextView android:id="@+id/text"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="text"
              android:layout_gravity="center_horizontal" />
    <Button android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="button"
            android:layout_gravity="center_horizontal" />
</LinearLayout>

The problem is that it doesn't look good on the simulator with Samsung Galaxy Tab's resolution. The view doesn't take all available space as I wish but only a portion. Is "match_parent" correct in layout's width and height?

解决方案:在manifest.xml中添加<uses-sdk android:minSdkVersion="4" />

我认为应该有fill_parent

      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" >

try this... it may work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM