2012-09-21 38 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