Android - 在可扩展列表中禁用一组的onClick突出显示?

时间:2015-07-17 23:27:07

标签: android layout expandablelistview expandablelistadapter

我有一个set jobFolder to choose folder with prompt "Choose the Job Folder:" tell application "Finder" set rootName to jobFolder's name set searchString to my FindSearchString(rootName) set replaceString to text returned of (display dialog ("This script will search for files that contain " & searchString & ". Please enter the replacement text and click OK.") default answer searchString) set everything to every file in (jobFolder's entire contents) repeat with onething in everything if ((onething's name) as text) contains searchString then set onething's name to my replace_chars(((onething's name) as text), searchString, replaceString) end if end repeat set jobFolder's name to my replace_chars(((jobFolder's name) as text), searchString, replaceString) end tell --------------------------------- on replace_chars(this_text, search_string, replacement_string) set astid to AppleScript's text item delimiters set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to astid return this_text end replace_chars --------------------------------- to FindSearchString(txt) set astid to AppleScript's text item delimiters set AppleScript's text item delimiters to "_" set sst to txt's text item 1 set AppleScript's text item delimiters to astid return sst end FindSearchString 的实施支持ExpandableListView。列表中的第一个组用作标题,不可扩展。我已设置BaseExpandableListAdapter为该群组返回false,并且所有内容都正常运行。但是,当用户单击此不可扩展组时,UI仍会突出显示该行。这是一个我想消除的令人困惑和不必要的视觉提示。

我无法设置android:listSelector =" @android:color / transparent"在ExpandableListView本身,因为我希望在点击和扩展时突出显示其他列表项。

是否可以抑制第一组的点击突出显示(仅限)?

2 个答案:

答案 0 :(得分:1)

尝试从OnClickListener将单个父视图的null设置为getGroupView()

View getGroupView(int groupPosition, boolean isExpanded, View convertView,
            ViewGroup parent) {
    ...
    convertView.setOnClickListener(null);
    ...
}

答案 1 :(得分:0)

android:listSelector="@android:color/transparent"

只需将此行添加到XML文件的展开列表中