Issue
I have this hexagon button in my drawable folder
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="27dp"
android:viewportHeight="28.0"
android:viewportWidth="26.0">
<path android:fillColor="#00ffffff"
android:pathData="m723,314c-60,103.9 -120,207.8 -180,311.8 -120,0 -240,0 -360,0C123,521.8 63,417.9 3,314 63,210.1 123,106.2 183,2.2c120,0 240,0 360,0C603,106.2 663,210.1 723,314Z"
android:strokeColor="#000000" android:strokeWidth="4"/>
But when I try to use it in my application it does not appear
<Button
android:id="@+id/btn_normal"
android:layout_width="241dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/btn_highscores"
android:layout_alignStart="@+id/btn_highscores"
android:layout_below="@+id/btn_easy"
android:layout_marginTop="58dp"
android:background="@drawable/hexagon"
android:text="Normal"
android:textColor="#FFFFFF" />
Solution
You seem to have the wrong coordinates for the vector path.
For starters, you have points with coordinates 700+ whereas the viewport height and width is 26.
If you change your viewport to 750 * 750 you can now see the hexagon shape in the drawable file:
However, as you can see, the shape is outside the visible area of the screen (see the blue area).
As such, I would advise you to try another set of coordinates for the hexagon shape.
Answered By - Vanethos
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.