2012-09-21 42 views
2

我正在嘗試爲應用程序的首次啓動開發幫助屏幕。要做到對設備的所有尺寸的工作,我已經做了9patch文件(別看在設計它的完全生的。我只是想理念,爲設計師的證明)第一次啓動時的幫助程序屏幕(9修補程序)

enter image description here

正如你所看到的,我想重複(根據屏幕大小)垂直左側空間和「滑動到」和「你已完成」之間的空間。

我已經把我的PNG在華電國際文件夾,我的活動包含以下資源佈局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:src="@drawable/helper" 
     android:scaleType="fitXY" /> 
</RelativeLayout> 

這裏是720像素的大圖片結果: 720px

下面是結果與一個圖片480px大: 480px portrait 480px landscape

這是結果與圖片240px大: 240px portrait 240px landscape

我想我有一個很好的尺度玩和LDPI/MDPI /華電國際/ xhdpi文件夾,也許還與推導LDPI-landscap/MDPI景觀....

是否有如何做到這一點?我的圖像應具有什麼樣的維度?

在此先感謝!

+2

我不知道你的問題的答案關閉我的頭頂。但是,我不明白爲什麼你要使它難以使用9patch圖像。你不能將覆蓋圖分成4個圖像。一個是半透明的灰色背景,另外三個是不同的箭頭/音符。通過這種方式,您將能夠正確對齊底部位置,並在所有方向上佈置圖像。 –

+0

您需要創建多個圖像,並使用各種分辨率來容納所有屏幕尺寸 – njzk2

+0

@ThomasClayson,因爲9-patch用於這種情況(用於匹配所有設備尺寸的可擴展區域)。我建議你把你的信息作爲答案,我會接受,如果沒有解決方案,我的9補丁文件。 – Hrk

回答

0

正如托馬斯·Clayson表明,我沒有做過4個,但2圖像:

  • 上圖:2個箭頭和相應的文字
  • 下圖:「切換到顯示」和「挖掘解僱」

這裏是我的 「測試」 佈局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:background="@color/my_translucent_background_color" > 

<ImageView 
    android:id="@+id/imageview_top" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/helper_top" 
    android:paddingLeft="20dp" 
    android:layout_weight="1" 
    android:layout_gravity="top|right" /> 

<ImageView 
    android:id="@+id/imageview_bottom" 
    android:layout_width="400dp" 
    android:layout_height="wrap_content" 
    android:paddingLeft="20dp" 
    android:paddingRight="20dp" 
    android:src="@drawable/helper_bottom" 
    android:layout_weight="2" 
android:layout_gravity="bottom|center_horizontal" /> 

當調整大小時,我仍然遇到一些頂部區域的問題,它不適合右上角。

1

我認爲你應該檢查該自定義視圖:ShowcaseView

它會做這樣的事情,你需要什麼來實現的,在一個更簡單,痛苦少,更兼容的方式。

+0

謝謝,我知道這個lib,但現在沒有支持動作欄按鈕,它似乎相當棘手的實施。 – Hrk