android - Always position "GOT IT" button of MaterialShowcaseView on the bottom left corner of the screen -
i'm using following library: https://github.com/deano2390/materialshowcaseview i've been trying find way (for 2 days straight!) position "got it" button on bottom left corner of screen. how achieve , effectively?
i accept working answer. can see, have history of accepting answers.
with osama's answer, error:
com.example.me.myapplication e/androidruntime: fatal exception: main process: com.example.me.myapplication, pid: 4445 java.lang.illegalstateexception: cannot start animator on detached view! @ android.view.rendernode.addanimator(rendernode.java:812) @ android.view.rendernodeanimator.settarget(rendernodeanimator.java:300) @ android.view.rendernodeanimator.settarget(rendernodeanimator.java:282) @ android.animation.revealanimator.<init>(revealanimator.java:37) @ android.view.viewanimationutils.createcircularreveal(viewanimationutils.java:55) @ uk.co.deanwild.materialshowcaseview.circularrevealanimationfactory.animateinview(circularrevealanimationfactory.java:29) @ uk.co.deanwild.materialshowcaseview.materialshowcaseview.animatein(materialshowcaseview.java:825) @ uk.co.deanwild.materialshowcaseview.materialshowcaseview$1.run(materialshowcaseview.java:794) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616)
mainactivity:
package com.example.me.myapplication; import android.support.v7.app.appcompatactivity; import android.os.bundle; import uk.co.deanwild.materialshowcaseview.materialshowcaseview; public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // single example new materialshowcaseview.builder(this) .settarget(findviewbyid(r.id.hi)) .setdismisstext("got it") .setcontenttext("this amazing feature should know about! indeed, example of bug can fixed!") .show(); } }
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.me.myapplication.mainactivity"> <textview android:id="@+id/hi" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello world!" app:layout_constraintbottom_tobottomof="parent" app:layout_constraintleft_toleftof="parent" app:layout_constraintright_torightof="parent" app:layout_constrainttop_totopof="parent" app:layout_constraintvertical_bias="0.419" /> </android.support.constraint.constraintlayout>
this lib based on showcaseview, take @ it.
you can go showcase_content.xml
@ library module , put tv_dismiss
"got it" textview
relativelayout
this:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/content_box" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="16dp" android:weightsum="1"> <textview android:id="@+id/tv_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="15dp" android:paddingleft="5dp" android:textcolor="@android:color/white" android:textsize="30dp" /> <textview android:id="@+id/tv_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingleft="5dp" android:textcolor="@android:color/white" android:textsize="20dp" /> <relativelayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <textview android:id="@+id/tv_dismiss" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margintop="20dp" android:background="?android:attr/selectableitembackground" android:clickable="true" android:layout_alignparentbottom="true" android:paddingbottom="10dp" android:paddingleft="5dp" android:paddingright="5dp" android:paddingtop="10dp" android:textcolor="@android:color/white" android:textsize="22dp" android:visibility="gone" /> </relativelayout> </linearlayout>
go materialshowcaseview.java
, empty applylayoutparams()
method , update setdelay
1000
Comments
Post a Comment