traex / RippleEffect

Implementation of Ripple effect from Material Design for Android API 9+
MIT License
4.93k stars 1.08k forks source link

Clearing margins of DialogFragment if using RippleView #97

Open lewkka opened 8 years ago

lewkka commented 8 years ago

Using rippleView for buttons in DialogFragment clear parent margin:

@Override
   public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.wrong_margins, container, false);

        getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.BLACK));

        return view;
   }

xml:

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:padding="4dp">

            <com.andexert.library.RippleView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="5dp"
                android:layout_weight="1"
                app:rv_alpha="250"
                app:rv_rippleDuration="300">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center" />
            </com.andexert.library.RippleView>

            <com.andexert.library.RippleView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_weight="1"
                app:rv_alpha="250"
                app:rv_rippleDuration="300">

                <Button
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center" />
            </com.andexert.library.RippleView>
</LinearLayout>

Result for this xml: https://i.gyazo.com/73741defa339efb51debfa7f895b73dd.png And without rippleViews it's OK(only buttons): https://i.gyazo.com/576dbdf4bb688af2a46e5216227834a9.png

Thanks