我有三个图像底盖,圆柱体和顶部头。我无法按照我的形象对齐它们。我需要一些帮助来做这件事,但徒劳无功。这是图像。如何在XmL中创建像这样的圆柱形设计图案android
我试图做这件事情以这种方式。这是代码。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cap_cylinder"
android:id="@+id/imageView" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/blue_cylinder"
android:layout_alignBottom="@+id/imageView"
android:layout_alignRight="@+id/imageView"
android:layout_alignEnd="@+id/imageView"
android:layout_marginBottom="39dp" />
<ImageView
android:src="@drawable/blue_cap_cylinder"
android:layout_alignRight="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
请帮我这么做。我只需要一个完整的设计实现。
平局。自定义视图可能是您需要的。我的意思是,根据百分比值动态拉伸。 –
哪种类型的customview。我从来没有做过。你可以解释一下或者你的自定义视图 – Junaid
。解释如何在这里将过于宽泛。基本上,您必须在每个周期重新绘制View内容,以便它立即对其暴露参数的更改作出反应。 –