我这里有一个Android布局xml文件:

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">

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" />

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" />

此xml布局呈现如下所示:

735d1d37ba4f31e9a1c166dfd947cf23.png

这适用于Android,但我想在iOS应用程序上使用此xml布局.我想知道是否有办法将此xml布局转换为svg或png格式或任何允许我重新使用此项而无需重新创建它的方法.它需要具有透明度,如果可行的话,.svg很可能比.png更好.如果可能的话,我希望只显示可见部分.

解决方法:

iOS中的等效技术是Apple的“自动布局”系统.

一旦掌握了它,它就很容易使用;事实是,就像任何事情一样,这是一个专业的事情.当然,你可以制作一个透明的PNG并将其用作UIButton的图像.

我真的建议在Apple中使用“UIButton”,并使用颜色等,直到你看起来没问题 – 尽管与其他平台不同.

两个关键点是

>从技术上讲,在不同平台上使应用看起来几乎是不可能的

>几乎每个人都同意你不应该试图这样做;除了在游戏中,允许按钮等元素在每个平台/ os版本上都是“自然的”.

顺便说一下,我不知道为什么有人会对你的问题进行投票.跨平台问题是当今发展中最关键的问题之一.

标签:android,ios,xml,png,svg

来源: https://codeday.me/bug/20190519/1136710.html

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐