2017-04-17 96 views
0

你好,我想創建一個列表。長按工具欄上會顯示選項全選並刪除選中。我不知道我是否應該RadioGroup和隱藏按鈕或使用listView並創建自己的行示例,並在那裏添加單選按鈕。radioGroup如何隱藏按鈕android

回答

0

默認標準的Android行爲語境操作欄(我可以解釋)應該來當用戶長按一個項目列表 在enter image description here

其中的許多資源都

http://theopentutorials.com/examples/android/listview/android-contextual-action-bar-for-listview-item-deletion-using-actionbarsherlock/

https://androidkennel.org/contextual-toolbar-actionbar-tutorial/

+0

非常感謝你。我不知道它是如何被稱爲 –

+0

我使用你的第二個鏈接創建了這個。我怎樣才能管理這個覆蓋工具欄,改變顏色和消除底部的粉紅線 –

+0

那麼你需要定製CAB與http://stackoverflow.com/questions/27458421/how-to-customize-the-contextual-action-bar -using-appcompat-in-material-design。爲了剪切列表項目,嘗試使用item-selector在這裏玩 android:drawable =」@ color/row_activated「android:state_activated =」true「/>

0

如果我不能說得很具體,我可以說,通常要實現自己的特定目標,創建自己的行將證明對您的最終目標有利。而不是躲在一個RadioGroup中

0

我有理解menuInflater一個小問題。這個類將菜單XML文件實例化爲Menu對象。但是,設定新的菜單

public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { //when this method is going to be made? Menu is int the toolbar and ListView isn't connected with toolbar so which menu I get in the next next line? 
    MenuInflater menuInflater = getMenuInflater(); 
    menuInflater.inflate(R.menu.toolbar_cab, menu); // in this line set a new menu 
    return true; 

}`