public final void aKY() { if (ipQ.iqA == 1) { izM.scrollTo(0, izM.getChildAt(0).getMeasuredHeight() - izM.getMeasuredHeight()); return; } izM.scrollTo(0, 0); }
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); _close_btn.measure( MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST)); _content.measure( MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec( height - _close_btn.getMeasuredHeight(), MeasureSpec.AT_MOST)); height = _close_btn.getMeasuredHeight() + _content.getMeasuredHeight(); this.setMeasuredDimension(width, height); }
/** 通过{@link #bottomItems}建立底部弹出框 */ private void buildBottomPopWindow() { if (bottomItems.size() <= 0) return; // 现将底部弹出框的所有选项去除 ll_bottom_content.removeAllViews(); popAnimation = null; reverseAnimation = null; final Iterator iterator = bottomItems.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<Integer, ArrayList<ItemHolder>> entry = (Map.Entry<Integer, ArrayList<ItemHolder>>) iterator.next(); Integer groupId = entry.getKey(); ArrayList<ItemHolder> holder = entry.getValue(); // 如果该groupId的items不为0,代表需要将该group显示出来 if (holder.size() >= 0) { BottomBarGroupLinearLayout group = (BottomBarGroupLinearLayout) inflater.inflate(R.layout.bottom_group_layout, null); group.setGroupId(groupId); group.setCallback( new BottomBarGroupLinearLayout.GroupItemClickCallback() { @Override public void callback(int groupId, int itemId) { onItemClickCallback(groupId, itemId); } }); for (ItemHolder temp : holder) { group.addItemToGroup(temp.itemId, temp.name); } LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); int margin = CommonUtils.dp2px(10); params.setMargins(margin, 0, margin, margin); ll_bottom_content.addView(group, params); } } // 每次组建完底部弹出框之后,就开始计算他的高度 int width = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); sv_bottom_content.measure(width, width); scrollViewMeasureHeight = sv_bottom_content.getMeasuredHeight(); }
private static boolean canScrollViewScroll(ScrollView sv) { if (sv.getChildCount() == 0) return false; final int childHeight = sv.getChildAt(0).getMeasuredHeight(); return sv.getMeasuredHeight() - sv.getPaddingTop() - sv.getPaddingBottom() < childHeight; }
@Override protected void layoutChildren(int l, int t, int width, int height) { setChildPosition(_content, l, t); setChildPosition( _close_btn, (width - _close_btn.getMeasuredWidth()) / 2, _content.getMeasuredHeight()); }