我这里有一个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的“自动布局”系统.
一旦掌握了它,它就很容易使用;事实是,就像任何事情一样,这是一个专业的事情.当然,你可以制作一个透明的PNG并将其用作UIButton的图像.
我真的建议在Apple中使用“UIButton”,并使用颜色等,直到你看起来没问题 – 尽管与其他平台不同.
两个关键点是
>从技术上讲,在不同平台上使应用看起来几乎是不可能的
>几乎每个人都同意你不应该试图这样做;除了在游戏中,允许按钮等元素在每个平台/ os版本上都是“自然的”.
顺便说一下,我不知道为什么有人会对你的问题进行投票.跨平台问题是当今发展中最关键的问题之一.
原文地址:https://codeday.me/bug/20190519/1136710.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。