本文整理了Java中android.widget.ListView.getChildCount()
方法的一些代码示例,展示了ListView.getChildCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.getChildCount()
方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:getChildCount
暂无
代码示例来源:origin: Naoki2015/CircleDemo
@Override
public int getChildCount() {
return mListView.getChildCount();
}
代码示例来源:origin: stackoverflow.com
public View getViewByPosition(int pos, ListView listView) {
final int firstListItemPosition = listView.getFirstVisiblePosition();
final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1;
if (pos < firstListItemPosition || pos > lastListItemPosition ) {
return listView.getAdapter().getView(pos, null, listView);
} else {
final int childIndex = pos - firstListItemPosition;
return listView.getChildAt(childIndex);
}
}
代码示例来源:origin: GitLqr/LQRWeChat
/**
* 判断mContentView是否处于顶部
*
* @return
*/
private boolean checkIsTop() {
int childCount = mContentView.getChildCount();
if (childCount > 0) {
View firstChild = mContentView.getChildAt(0);
if (firstChild.getTop() >= 0
&& firstItem == 0 && currentTop == 0) {
return true;
} else return false;
} else {
return false;
}
}
代码示例来源:origin: GitLqr/LQRWeChat
/**
* 判断是否需要拦截触摸事件
*
* @return
*/
private boolean shouldIntercept() {
if (bDraging) return true;
int childCount = mContentView.getChildCount();
if (childCount > 0) {
View firstChild = mContentView.getChildAt(0);
if (firstChild.getTop() >= 0
&& firstItem == 0 && currentTop == 0
&& bScrollDown) {
return true;
} else return false;
} else {
return true;
}
}
代码示例来源:origin: stackoverflow.com
public View getViewByPosition(int position, ListView listView) {
final int firstListItemPosition = listView.getFirstVisiblePosition();
final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1;
if (position < firstListItemPosition || position > lastListItemPosition ) {
return listView.getAdapter().getView(position, null, listView);
} else {
final int childIndex = position - firstListItemPosition;
return listView.getChildAt(childIndex);
}
}
代码示例来源:origin: stackoverflow.com
public static int dpToPx(int dp, Context ctx) {
Resources r = ctx.getResources();
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
}
//originally: http://stackoverflow.com/questions/5418510/disable-the-touch-events-for-all-the-views
//modified for the needs here
public static void enableDisableViewGroup(ViewGroup viewGroup, boolean enabled) {
int childCount = viewGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
View view = viewGroup.getChildAt(i);
if(view.isFocusable())
view.setEnabled(enabled);
if (view instanceof ViewGroup) {
enableDisableViewGroup((ViewGroup) view, enabled);
} else if (view instanceof ListView) {
if(view.isFocusable())
view.setEnabled(enabled);
ListView listView = (ListView) view;
int listChildCount = listView.getChildCount();
for (int j = 0; j < listChildCount; j++) {
if(view.isFocusable())
listView.getChildAt(j).setEnabled(false);
}
}
}
}
代码示例来源:origin: umano/AndroidSlidingUpPanel
return (child.getBottom() - (sv.getHeight() + sv.getScrollY()));
} else if (scrollableView instanceof ListView && ((ListView) scrollableView).getChildCount() > 0) {
ListView lv = ((ListView) scrollableView);
if (lv.getAdapter() == null) return 0;
View lastChild = lv.getChildAt(lv.getChildCount() - 1);
代码示例来源:origin: cSploit/android
private void setStoppedState(){
int rows = mActionListView.getChildCount(),
i;
boolean somethingIsRunning = false;
ActionAdapter.ActionHolder holder;
View row;
for(i = 0; i < rows && somethingIsRunning == false; i++){
if((row = mActionListView.getChildAt(i)) != null){
holder = (ActionAdapter.ActionHolder) row.getTag();
if(holder.activity.getVisibility() == View.VISIBLE)
somethingIsRunning = true;
}
}
if(somethingIsRunning){
Logger.debug("Stopping current jobs ...");
if(mSpoofSession != null){
mSpoofSession.stop();
mSpoofSession = null;
}
for(i = 0; i < rows; i++){
if((row = mActionListView.getChildAt(i)) != null){
holder = (ActionAdapter.ActionHolder) row.getTag();
holder.activity.setVisibility(View.INVISIBLE);
}
}
}
}
代码示例来源:origin: gzu-liyujiang/AndroidPicker
for (int i = 0; i < listView.getChildCount(); i++) {
height += listView.getChildAt(i).getHeight();
代码示例来源:origin: wangdan/AisenWeiBo
public void show() {
int top = 0;
if (getRefreshView().getChildCount() > 0 && getRefreshView().getChildAt(0).getHeight() > 0) {
top = getRefreshView().getChildAt(0).getHeight() * 3;
}
else {
top = Utils.dip2px(getActivity(), 175);
}
getRefreshView().setSelectionFromTop(selectedPosition, top);
}
代码示例来源:origin: stackoverflow.com
int childCount = mListView.getChildCount();
int[] listViewCoords = new int[2];
mListView.getLocationOnScreen(listViewCoords);
代码示例来源:origin: robolectric/robolectric
@Test
public void setAdapter_shouldNotClearHeaderOrFooterViews() throws Exception {
View header = new View(context);
listView.addHeaderView(header);
View footer = new View(context);
listView.addFooterView(footer);
prepareListWithThreeItems();
assertThat(listView.getChildCount()).isEqualTo(5);
assertThat(listView.getChildAt(0)).isSameAs(header);
assertThat(listView.getChildAt(4)).isSameAs(footer);
}
代码示例来源:origin: waynell/VideoListPlayer
@Override
public int getChildCount() {
return mListView.getChildCount();
}
代码示例来源:origin: stackoverflow.com
for (int i = 0; i < list.getChildCount(); i++) {
(list.getChildAt(i).getBackground()).setState(new int[] { 0 });
代码示例来源:origin: stackoverflow.com
CheckBox cb;
ListView mainListView = getListView();
for (int x = 0; x<mainListView.getChildCount();x++){
cb = (CheckBox)mainListView.getChildAt(x).findViewById(R.id.myCheckBox);
if(cb.isChecked()){
doSomething();
}
}
代码示例来源:origin: waynell/VideoListPlayer
@Override
public ListItem getListItem(int position) {
// find the list item
int childCount = mListView.getChildCount();
for (int i = 0; i < childCount; i++) {
View view = mListView.getChildAt(i);
if(view != null) {
if (view.getTag() instanceof VideoViewHolder) {
VideoViewHolder holder = (VideoViewHolder) view.getTag();
int holderPosition = mHolderHelper.get(holder);
if (holderPosition == position) {
return holder;
}
}
}
}
return null;
}
代码示例来源:origin: stackoverflow.com
for (int i = 0; i < listview.getChildCount(); ++i) {
View child = listview.getChildAt(i);
if (child != viewToRemove) {
boolean firstAnimation = true;
int firstVisiblePosition = listview.getFirstVisiblePosition();
for (int i = 0; i < listview.getChildCount(); ++i) {
final View child = listview.getChildAt(i);
int position = firstVisiblePosition + i;
代码示例来源:origin: stackoverflow.com
&& (mList.getChildCount() == 0 || mList.getChildAt(0).getTop() == 0)) {
if ((mInterceptY - oldLastY > 5) || (mState == STATE_PULL) || (mState == STATE_RELEASE)) {
mScrollingList = false;
代码示例来源:origin: nirhart/ParallaxScroll
private void headerParallax() {
if (parallaxedView != null) {
if (listView.getChildCount() > 0) {
int top = -listView.getChildAt(0).getTop();
if (top >= 0) {
setFilters(top);
}
}
}
}
代码示例来源:origin: nirhart/ParallaxScroll
private void circularParallax() {
if (listView.getChildCount() > 0) {
int top = -listView.getChildAt(0).getTop();
if (top >= 0) {
fillParallaxedViews();
setFilters(top);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!