Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
462 views
in Technique[技术] by (71.8m points)

android - How to design tilted diagonal or rounded rectangle drawable resource file for login screen background?

I want to design background layout for the login screen. I want to design something just like this:

[expected output]

I tried to design it however i am not able to use rounded corners. The output looks like this: (Updated Output)

[actual output]

Below is the code for the drawable resource file.

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/rectangle">
    <shape
        android:shape="rectangle">
        <solid android:color="#0D758D"/>
        <corners
            android:radius="50dp"/>
    </shape>
</item>
<item android:top="300dp"
    android:bottom="300dp"
    android:left="-100dp"
    android:right="-300dp">
    <rotate
        android:fromDegrees="25"
        android:pivotX="20%"
        android:pivotY="65%">

        <shape
            android:shape="rectangle">
            <solid android:color="#FFFFFF"/>
            <corners
                android:radius="8dp"/>
        </shape>
    </rotate>
</item>

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Finally i got the solution :

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="500"
android:viewportHeight="749"
android:width="625dp"
android:height="936.25dp">
<group
    android:scaleX="0.1"
    android:scaleY="-0.1"
    android:translateY="749">
    <path
        android:pathData="M439 7416C282 7361 169 7248 113 7090l-23 -65 0 -1751c0 -1693 1 -1753 19 -1806 35 -101 99 -185 184 -241 57 -38 90 -50 442 -162 132 -42 701 -224 1265 -405 564 -180 1084 -346 1155 -368 72 -22 362 -114 645 -206 558 -179 630 -196 749 -177 165 27 267 129 316 316 13 53 15 321 15 2410 0 2572 4 2397 -58 2523 -56 115 -184 223 -310 262 -63 20 -97 20 -2036 20l-1971 0 -66 -24z"
        android:fillColor="#ffffff" />
    <path
        android:pathData="M498 2820C322 2790 207 2702 128 2534L95 2465 92 1476C90 496 90 486 110 424 155 289 255 178 389 112l76 -37 1998 -3 1997 -2 63 21c160 53 293 193 338 357 17 59 19 106 19 407 0 369 -4 404 -56 507 -55 109 -179 205 -304 237 -25 7 -54 16 -65 21 -11 5 -206 68 -433 140 -227 72 -677 214 -1000 316 -323 102 -623 197 -667 211 -44 14 -343 108 -665 210 -322 102 -691 218 -820 259 -240 76 -271 81 -372 64z"
        android:fillColor="#ffffff" />
</group>
</vector>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...