Java 曲线矢量可绘制未获得全宽
您好,我正在开发一个应用程序,我使用vector drawable创建自定义形状,但我的问题是,第一个形状没有创建,第二个形状创建正确,但没有获得全宽 这是我的现金 这就是我想说的 如果您有任何帮助,我们将不胜感激 main.xmlJava 曲线矢量可绘制未获得全宽,java,android,xml,android-layout,Java,Android,Xml,Android Layout,您好,我正在开发一个应用程序,我使用vector drawable创建自定义形状,但我的问题是,第一个形状没有创建,第二个形状创建正确,但没有获得全宽 这是我的现金 这就是我想说的 如果您有任何帮助,我们将不胜感激 main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" an
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context="com.ct.listrtrial.fragments.ProfileFragment">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="250dp"
android:src="@drawable/profile_first_image"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="170dp"
android:src="@drawable/profile_second_image"/>
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="146dp"
android:layout_height="146dp"
android:src="@drawable/ellipse2"
android:layout_gravity="center"
/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="right"
android:src="@drawable/pencil"/>
</FrameLayout>
</LinearLayout>
还有我的两张矢量画
profile_first_image.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="248dp"
android:height="148dp"
android:viewportHeight="12"
android:viewportWidth="12">
<path
android:fillColor="#f1c40f"
android:pathData="M 0,0 L 0,11 C 1,12 5,12 8,12 C 12,12 12,11 12,11 L 12,0 0,0"
android:strokeWidth="0.1"/>
</vector>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF"/>
<size
android:width="30dp"
android:height="15dp"/>
<corners
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"/>
</shape>
profile_second_image.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="248dp"
android:height="148dp"
android:viewportHeight="12"
android:viewportWidth="12">
<path
android:fillColor="#f1c40f"
android:pathData="M 0,0 L 0,11 C 1,12 5,12 8,12 C 12,12 12,11 12,11 L 12,0 0,0"
android:strokeWidth="0.1"/>
</vector>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF"/>
<size
android:width="30dp"
android:height="15dp"/>
<corners
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"/>
</shape>
试试这个
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorAccent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/profile_first_image">
<ImageView
android:layout_width="match_parent"
android:layout_height="250dp"
android:src="@drawable/profile_first_image"
android:visibility="gone" />
<ImageView
android:id="@+id/second_image"
android:layout_width="match_parent"
android:layout_height="170dp"
android:layout_marginBottom="20dp"
android:scaleType="centerCrop"
android:src="@drawable/profile_second_image" />
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:src="@drawable/goku3" />
</RelativeLayout>
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="146dp"
android:layout_height="146dp"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="96dp"
android:layout_marginTop="113dp"
android:src="@drawable/kid_goku" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nilesh" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nilesh" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nilesh" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nilesh" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nilesh" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nilesh" />
</LinearLayout>
</LinearLayout>
android:src=“@drawable/profile\u second\u image”
android:src=“@drawable/profile\u first\u image”
输出
为什么不使用内部有两个
的
(用于白色和黄色形状)?Hi@pskink你能告诉我如何使用第一个向量,因为我无法获得正确的曲线使用inkscape
并设计你的形状,保存到.svg文件,然后导入android studioHi@Nilesh,但如何使背景完全弯曲,如图像@john check updated ans中所示,我已在profile\u first\u图像中进行了更改