изогнутый вектор рисования не получается полная ширина - PullRequest
0 голосов
/ 02 мая 2018

Привет, я занимаюсь разработкой приложения, в котором я использую векторную графику для создания пользовательских фигур, однако моя проблема в том, что первая фигура не создается, а вторая создается должным образом, но не получает полную ширину. Вот мой текущий вывод и вот что я пытаюсь достичь Пожалуйста, любая помощь будет оценена

main.xml

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

profile_second_image.xml

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

1 Ответ

0 голосов
/ 02 мая 2018

Попробуйте это

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

андроид: SRC = "@ вытяжка / profile_second_image"

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

андроид: SRC = "@ вытяжка / profile_first_image" ** 1014

    <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,8 C 1,12 5,12 8,12 C 10,12 12,11 15,1 L 12,0 0,0"
        android:strokeWidth="0.1"/>

</vector>

OUTPUT

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...