本文整理汇总了Java中android.widget.ListView.getFooterViewsCount方法的典型用法代码示例。如果您正苦于以下问题:Java ListView.getFooterViewsCount方法的具体用法?Java ListView.getFooterViewsCount怎么用?Java ListView.getFooterViewsCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ListView
的用法示例。
在下文中一共展示了ListView.getFooterViewsCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isLastMessageVisible
import android.widget.ListView; //导入方法依赖的package包/类
public static boolean isLastMessageVisible(ListView messageListView) {
if(messageListView == null || messageListView.getAdapter() == null) {
return false;
}
if (messageListView.getLastVisiblePosition() >= messageListView.getAdapter().getCount() - 1 - messageListView.getFooterViewsCount()) {
return true;
} else {
return false;
}
}
示例2: setSongList
import android.widget.ListView; //导入方法依赖的package包/类
public void setSongList(String json) throws JSONException{
View requestView = viewPager.findViewById(R.id.requests_page);
TextView searchMsg = (TextView) requestView.findViewById(R.id.searchMsg);
ListView songListView = (ListView) requestView.findViewById(R.id.songListView);
Integer curPage, lastPage;
try {
JSONObject searchObject = new JSONObject(json);
JSONArray songs = new JSONArray(searchObject.getString("data"));
ArrayList<Song> songList = new ArrayList<>();
curPage = searchObject.getInt("current_page");
lastPage = searchObject.getInt("last_page");
for (int i = 0; i < songs.length(); i++){
JSONObject songObject = songs.getJSONObject(i);
if(songObject != null){
String artist = songObject.getString("artist");
String title = songObject.getString("title");
Integer songID = songObject.getInt("id");
boolean requestable = songObject.getBoolean("requestable");
Song song = new Song(artist, title, songID, requestable);
songList.add(song);
}
}
if(songs.length() == 0) {
searchMsg.setVisibility(View.VISIBLE);
searchMsg.setText("No songs found for query.");
} else {
searchMsg.setVisibility(View.INVISIBLE);
}
if(searchFooter == null || songListView.getFooterViewsCount() == 0) {
createSearchFooter(curPage, lastPage);
songListView.addFooterView(searchFooter);
}
else {
createSearchFooter(curPage, lastPage);
}
SongAdapter sAdapt = new SongAdapter(this, R.layout.request_cell, songList);
songListView.setAdapter(sAdapt);
}
catch(JSONException ex){
searchMsg.setVisibility(View.VISIBLE);
searchMsg.setText("An error occurred while retrieving songs. Please try again.");
}
}