我有九個補丁圖像的背景。這是802px x 286px(2px在兩個w &小時自動添加9patchtools)。九個修補圖像是否可縮小?
main.xml中的樣子:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/crown"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/crown">
<ListView
android:id = "@+id/mainmenulist"
style="@style/MainMenuList"
android:dividerHeight="2.5dp"/>
</RelativeLayout>
的styles.xml樣子:
<resources
xmlns:android="http://schemas.android.com/apk/res/android">
<style name="MainMenuList">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:cacheColorHint">@android:color/transparent</item>
<item name="android:listSelector">@android:color/transparent</item>
<item name="android:divider">@null</item>
<item name="android:gravity">right</item>
</style>
<style name="MainMenuRow">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#000000</item>
<item name="android:gravity">right|center</item>
<item name="android:padding">0dp</item>
</style>
</resources>
價值觀文件夾中的themes.xml:
<resources
xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="android:Theme.Light.NoTitleBar.Fullscreen">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@color/mycustomblue</item>
</style>
</resources>
艙單mpart .xml:
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:theme="@style/AppTheme">
它的行圖像:
它的背景(冠)圖像:
輸出應該是這樣的:
但它看起來是這樣的:
我的問題是:
我的九幅圖像的背景是802x286。我的設備是Android 4.0.4和720x1280(WxH)的galaxy S3。圖像是否可以縮小以適應寬度? (換句話說,如果我使用9xatch圖像100x100的設備是200x200,我們知道它的好處並擴大規模,但問題是如果使用的設備是50x50,會發生什麼?)
爲什麼我的應用程序不是全屏嗎?
爲什麼示例文本不是中間和右對齊?
爲什麼行圖像過度放大?
在9-patch圖像中,你是否打算讓內容佔據整個垂直空間(使用正確的黑色標記)? –
是的,右邊的黑色標記是左邊黑色標記的前面。所以當圖像垂直縮放時,內容區域會增加。 –
我不明白你的答案。文本似乎不需要插入頂部/底部區域,爲什麼不將內容設置在中間?目前的配置顯示它沒有縮放 - 內容佔據整個垂直空間。也許它與問題本身有關。 –