Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change menu items once created #155

Open
vishalkaushal-mprog opened this issue Apr 19, 2017 · 2 comments
Open

How to change menu items once created #155

vishalkaushal-mprog opened this issue Apr 19, 2017 · 2 comments

Comments

@vishalkaushal-mprog
Copy link

Hi, Please tell me how to change mneu items once created (after mListView.setMenuCreator(creator) ).
As I have to filter the list but on Swipe shows menu as in the order of list created and menus set on creation.

@MrCroxx
Copy link

MrCroxx commented May 26, 2017

I've got the same problem and i tried to change it in "OnClickItem" but it doesn't work. How can I update the UI after changing the items of the menu?

@MrCroxx
Copy link

MrCroxx commented May 26, 2017

@vishalkaushal-mprog @baoyongzhang
I've just solved the problem in a "hack way".
The structure of a View of an Item looks like this(using icon):

SwipeMenuLayout
|--Your Item Layout
|--SwipeMenuView(one of a SwipeMenuItem you created)
    |--LinearLayout(a container)
        |--ImageView(Your icon)
|--SwipeMenuView(one of a SwipeMenuItem you created (Folded) )
|--SwipeMenuView(one of a SwipeMenuItem you created (Folded) )
... and so on

So your can approach your item icon in the following "hack way":

public void updateIcon(int position) {

            SwipeMenuLayout view = (SwipeMenuLayout) listView.getChildAt(position);

            SwipeMenuView menuView = (SwipeMenuView) view.getChildAt(1);

            ImageView img = (ImageView) ((LinearLayout) menuView.getChildAt(0)).getChildAt(0);

           // UPDATE img

}

You can get more information in SwipeMenuView.java :)

(话说希望作者老铁加个API上去吧>w<)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants