shadowfaxtech / proSwipeButton

A swipe button for Android with a circular progress bar for async operations
MIT License
346 stars 48 forks source link

After use ProSwipeButton my layout.xml gets crazy #2

Open pess0a opened 6 years ago

pess0a commented 6 years ago

Before use: image

after use: image

ishaangarg commented 6 years ago

Are you using coordinator layout? Can you post your layout XML?

pess0a commented 6 years ago

Im not using coordinator.

`<?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:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/background_color" tools:context="com.marydrivedriver.app.trip.TripActivity">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:background="@color/white"
    android:elevation="5dp"
    android:id="@+id/relativeLayout6">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="4">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="vertical">

            <TextView
                android:id="@+id/textview_title_address"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16sp"
                android:layout_marginTop="16sp"
                android:textSize="14sp"
                android:textStyle="bold"
                android:textColor="@color/light_gray"
                android:text="LOCAL DE PARTIDA"/>

            <TextView
                android:id="@+id/textview_address"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:textSize="24sp"
                android:paddingLeft="16dp"
                android:paddingRight="16dp"
                android:textColor="@color/md_black_1000"
                android:text="Rua dom jose lopes 604 - boa viagem"
                />
        </LinearLayout>

        <View
            android:id="@+id/divider"
            android:layout_width="2dp"
            android:layout_height="match_parent"
            android:layout_marginBottom="16dp"
            android:layout_marginTop="16dp"
            android:layout_toLeftOf="@id/imageview_maps"
            android:background="@color/gray">

        </View>

        <LinearLayout
            android:id="@+id/linearlayout_navigation"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:layout_weight="3"
            android:gravity="center">

            <ImageView
                android:id="@+id/imageview_maps"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_navigation" />

            <TextView
                android:id="@+id/textview_time"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:textStyle="bold"
                android:text="4 min" />

            <TextView
                android:id="@+id/textView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_above="@+id/trip_map"
                android:gravity="center"
                android:layout_gravity=""
                android:text="NAVEGAR" />

        </LinearLayout>

    </LinearLayout>

</RelativeLayout>

<fragment
    android:id="@+id/trip_map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentStart="true"
    android:layout_below="@+id/relativeLayout6"
    android:layout_above="@+id/button_local"
    tools:context="com.marydrivedriver.home.HomeActivity" />

<include android:id="@+id/news_title"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    layout="@layout/modal_rider"
    android:layout_above="@id/button_local"/>

<!-- -->
<in.shadowfax.proswipebutton.ProSwipeButton
    android:id="@+id/button_local"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    app:text_size="16sp"
    app:bg_color="@color/primary"
    app:btn_text="Estou no local" />

`

ishaangarg commented 6 years ago

I had to cleanup your layout XML a bit. Wrapped the whole thing inside another RelativeLayout. replaced fragment tag with a View tag and commented out the include layout as I dont have that.

After all these changes it is working fine. Make sure you test on a real device or emulator as Android Studio wont show the button in its layout preview

For me to better understand what's wrong, please upload a screenshot from a real device or emulator, not Studio preview window :)

Here's the layout code I got working: Gist Link

Here's the screenshot: screenshot_1516797236