Skip to content

Example of custom view #37

@pellyadolfo

Description

@pellyadolfo

As I have not seen any example of positioning the messages in a custom view, I want to share how I solved the problem to get inputs from other users. I am not sure if this is the proper way but it works for me.... more or less:

I added this code to the layout embedded in a RelativeLayout:

                      <!-- required by AppMsg to position in another place -->
                      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                          android:id="@+id/messagescontainer"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_centerInParent="true">

                          <include layout="@layout/app_msg"/>

                      </LinearLayout>

and this code into the Java

            LinearLayout messagesContainer = (LinearLayout) findViewById(R.id.messagesContainer);

            AppMsg.makeText(OfferActivity.this, "Error Performing this Operation", AppMsg.STYLE_ALERT, carouselContainer).show();

However, there seems to be a bug because the message is shown as soon is instantiated in makeText(), without the need to call show() method. However, you need to call show() in order to make cancel() method work. Otherwise, cancel() does not remove the message.

Are these bugs or I am not using it in the proper way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions