進出口面臨的一個大問題:Android的圖形佈局圖像
我創建一個背景圖像繪製,xxhdpi:1920×1080,並繼續與xhdpi 1280×720和960×540華電國際。背景圖像有一個方形的繪製,在那裏放置一個按鈕。
xxhdpi中按鈕的圖像是360x126,xhdpi 240x84和hdpi 180x63。
問題出在hdpi。如果我使用具有分辨率960x540的設備,圖像按鈕看起來不錯。 但是,當我在三星S2具有480x800的分辨率測試時,背景圖像調整大小以適應解決方案,但圖像按鈕沒有。圖像按鈕仍然是180x63,顯然不適合背景圖像的繪製平方。 我需要的是,按鈕的圖像調整大小取決於屏幕的分辨率。我認爲android會自動執行此操作。
活動代碼:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background_image"
tools:context="com.trucouruguayo.MainActivity" >
<Button
android:id="@+id/buttonPlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="8dp"
android:layout_marginTop="109dp"
android:background="@drawable/btn_play"
android:minHeight="0dp"
android:minWidth="0dp"
android:onClick="goToPlay" />
你如何使用背景圖片請幫
你使用 – nifCody
這IDE我想不aumatically鏈接的解決方案插件。它必須取決於你的不同文件夾中的可繪製。你可以把你的佈局和一些代碼? –
我正在使用Eclipse。 – user3240604