我正在Eclipse上的4in模擬器上開發我的應用程序。我的手機是4.6英寸的Android設備,當我在那裏測試時,內容無法正確縮放。Android沒有調整大小?
它看起來像手機保持在相同的大小的內容,它只是將所有東西都上移,並留出額外的空間。
從我讀過的內容來看,我認爲它應該保持相同的佈局,只要我使用dp而不是。這是否意味着我的圖像也需要dp?
有什麼建議嗎?
編輯:
下面是一些代碼:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/tfltestbg2"
android:orientation="vertical" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="55dp"
android:background="@drawable/tfl_header_port"
android:gravity = "center_horizontal"
android:layout_gravity = "center_horizontal"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:layout_gravity = "center"
android:gravity = "center"
>
<Button
android:id="@+id/buttonTakePic"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:gravity = "left"
android:background="@drawable/takepic_button" />
<Button
android:id="@+id/mMegaGalleryButton"
android:layout_width="120dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity = "center"
android:background="@drawable/add_fotos" />
<Button
android:id="@+id/mGalleryButton"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:gravity = "right"
android:background="@drawable/selectpic"
android:paddingLeft = "10dp"
android:paddingRight = "10dp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/image_container"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_gravity="center"
android:background="@drawable/outline_box"
android:gravity="center">
<FrameLayout
android:layout_width = "match_parent"
android:layout_height = "fill_parent"
android:gravity = "center"
android:layout_gravity = "center">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background = "@drawable/blank"
android:gravity="center" />
<ImageView
android:id="@+id/picsImage"
android:layout_width = "100dp"
android:layout_height = "100dp"
android:layout_gravity="center"
android:gravity="center"
android:background = "@drawable/picture_box"/>
</FrameLayout>
</LinearLayout>
<Button
android:id="@+id/mEditButton"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="@drawable/edit_pic_button" />
<View
android:layout_width="match_parent"
android:layout_height="10dp" />
<Button
android:id="@+id/buttonUploadPic"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="@drawable/upload_pic_button" />
</LinearLayout>
發佈一些有問題的XML。 – njzk2
這真的很長,但我會繼續發佈。 – user1513687
不要使用背景進行圖像瀏覽,請使用src。你的3個第一個按鈕有dp-fixed,這意味着它們不會佔用所有空間。爲此使用重量。所有你的一級物品都有固定的高度,這意味着它們不會佔用所有可用的高度。使用重量。 – njzk2