如何将 Android xml 布局转换为 png/svg 以在 iOS 版本中使用
How to convert Android xml layout to png/svg to use in iOS version
我这里有一个 Android 布局 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/locationMarker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="30dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/locationMarkertext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_map"
android:gravity="center"
android:minWidth="180dp"
android:onClick="create"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:text="Pick the Location"
android:textColor="@android:color/white" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:onClick="create"
android:src="@drawable/plus" />
</LinearLayout>
此 xml 布局呈现如下所示:
这适用于 android,但我也想在 iOS 应用程序上使用此 xml 布局。我想知道是否有办法将此 xml 布局转换为 svg 或 png 格式或任何可以让我重新使用此项目而无需重新创建它的格式。它需要具有透明度,如果可行的话,.svg 很可能比 .png 更好。如果可能的话,我希望只有显示的可见部分是可点击的。
iOS 中的等效技术是 Apple 的 "autolayout" 系统。
一旦掌握了它,它就非常容易使用;事实上,就像任何东西一样,它是一个专业的东西。当然,您可以制作一个透明的 PNG 并将其用作 UIButton 的图像。
我真的建议只在 Apple 中使用 "UIButton",并尝试使用颜色等,直到您获得合适的外观 -- 尽管与其他平台不同.
两个关键点是
这很重要ost impos从技术上讲,使应用程序在不同平台上看起来完全相同
几乎每个人都同意您不应该尝试那样做;除游戏外,允许按钮等元素在每个平台/os 版本上 "natural"。
顺便说一句,我不知道为什么有人会对你的问题投反对票。 Cross 平台问题是当今开发中最重要的问题之一。os
我这里有一个 Android 布局 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/locationMarker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="30dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/locationMarkertext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_map"
android:gravity="center"
android:minWidth="180dp"
android:onClick="create"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:text="Pick the Location"
android:textColor="@android:color/white" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:onClick="create"
android:src="@drawable/plus" />
</LinearLayout>
此 xml 布局呈现如下所示:
这适用于 android,但我也想在 iOS 应用程序上使用此 xml 布局。我想知道是否有办法将此 xml 布局转换为 svg 或 png 格式或任何可以让我重新使用此项目而无需重新创建它的格式。它需要具有透明度,如果可行的话,.svg 很可能比 .png 更好。如果可能的话,我希望只有显示的可见部分是可点击的。
iOS 中的等效技术是 Apple 的 "autolayout" 系统。
一旦掌握了它,它就非常容易使用;事实上,就像任何东西一样,它是一个专业的东西。当然,您可以制作一个透明的 PNG 并将其用作 UIButton 的图像。
我真的建议只在 Apple 中使用 "UIButton",并尝试使用颜色等,直到您获得合适的外观 -- 尽管与其他平台不同.
两个关键点是
这很重要ost impos从技术上讲,使应用程序在不同平台上看起来完全相同
几乎每个人都同意您不应该尝试那样做;除游戏外,允许按钮等元素在每个平台/os 版本上 "natural"。
顺便说一句,我不知道为什么有人会对你的问题投反对票。 Cross 平台问题是当今开发中最重要的问题之一。os