如何在Android中创建此形状
我想要创建这样的形状:如何在Android中创建此形状,android,android-shape,Android,Android Shape,我想要创建这样的形状: 但我不想使用9 pach pngimage,我想在可绘制文件夹中创建此形状。 我如何创建这个? 任何帮助都将不胜感激!谢谢创建您的布局 在可绘制文件中创建my_shape4.xml 结果 创建您的布局 在可绘制文件中创建my_shape4.xml 结果 三角形至少需要一个9面片。否则,它是2rectangles@cricket_007,是的,它是2个矩形,但我不想使用9面片图像。我想用shapeIt创建这个,也许值得一看这个帖子:@cricket_007
但我不想使用
9 pach png
image,我想在可绘制文件夹中创建此形状。我如何创建这个? 任何帮助都将不胜感激!谢谢创建您的布局
在可绘制文件中创建my_shape4.xml
结果
创建您的布局
在可绘制文件中创建my_shape4.xml
结果
三角形至少需要一个9面片。否则,它是2rectangles@cricket_007,是的,它是2个矩形,但我不想使用9面片图像。我想用shapeIt创建这个,也许值得一看这个帖子:@cricket_007,谢谢你,伙计,我用可绘制的XML创建这个。创建此主题后,我将在此主题中发送代码。感谢您的帮助。三角形至少需要一个9补丁。否则,它是2rectangles@cricket_007,是的,它是2个矩形,但我不想使用9面片图像。我想用shapeIt创建这个,也许值得一看这个帖子:@cricket_007,谢谢你,伙计,我用可绘制的XML创建这个。创建此主题后,我将在此主题中发送代码。谢谢你的帮助。请你解释一下,你是如何创建我的形状的。xml@UmarAta在您的drawable文件夹中创建一个名为my_shape4.xml的示例文件,并复制我在答案中发布的副本。容易的!!这不是我要问的,我只是想问,你是如何为这个形状绘制向量的?有没有任何关于decumentation的教程或链接?@UmarAta你可以在中准备更多关于向量的内容,请解释一下,您是如何创建我的_形状4的。xml@UmarAta在您的drawable文件夹中创建一个名为my_shape4.xml的示例文件,并复制我在答案中发布的副本。容易的!!这不是我要问的,我只是想问,你是如何为这个形状绘制向量的?有没有任何关于decumentation的教程或链接?@UmarAta你可以在
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.ul_ts.emvsdktester.drawabletraining.Main7Activity">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/my_shape4"></LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="100dp"
android:viewportHeight="100"
android:viewportWidth="100">
<group>
<path
android:pathData="M0 20 L50 20 L60 0 L100 0"
android:strokeColor="#000000"
android:strokeWidth="4" />
<path
android:fillColor="#42ce3b"
android:pathData="M100 0 L100 50 L0 50 L0 20 L50 20 L60 2 L100 2"
android:strokeWidth="0" />
</group>
</vector>