本文整理匯總了Java中android.widget.LinearLayout.indexOfChild方法的典型用法代碼示例。如果您正苦於以下問題:Java LinearLayout.indexOfChild方法的具體用法?Java LinearLayout.indexOfChild怎麽用?Java LinearLayout.indexOfChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.indexOfChild方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: switchItemFromPosition
import android.widget.LinearLayout; //導入方法依賴的package包/類
private void switchItemFromPosition(int change,View view){
LinearLayout parentLayout = (LinearLayout)(view.getParent());
int columnPos = parentLayout.indexOfChild(view);
if(columnPos+change >= 0 && columnPos+change < parentLayout.getChildCount()) {
parentLayout.removeView(view);
parentLayout.addView(view, columnPos + change);
if(mDragItemStartCallback != null){
int newPos = parentLayout.indexOfChild(view);
last_swap = System.currentTimeMillis();
mLastSwap = newPos;
int newColumnPos = ((LinearLayout)mobileView.getParent().getParent().getParent().getParent()).indexOfChild((View)(mobileView.getParent().getParent().getParent()));
mDragItemStartCallback.changedPosition(view,originalItemPosition,originalPosition,newPos,newColumnPos);
}
}
}
示例2: setTitleBar
import android.widget.LinearLayout; //導入方法依賴的package包/類
@Override
public void setTitleBar(TitleBarView titleBar) {
isSliding = (boolean) SPUtil.get(mContext, SPConstant.SP_KEY_ACTIVITY_TAB_SLIDING, true);
if (isSliding && viewSliding == null) {
viewSliding = View.inflate(mContext, R.layout.layout_activity_sliding, null);
mSlidingTab = viewSliding.findViewById(R.id.tabLayout_slidingActivity);
} else if (!isSliding && viewSegment == null) {
viewSegment = View.inflate(mContext, R.layout.layout_activity_segment, null);
mSegmentTab = viewSegment.findViewById(R.id.tabLayout_segment);
}
LinearLayout center = titleBar.getLinearLayout(Gravity.CENTER);
if (isSliding) {
if (center.indexOfChild(viewSliding) == -1) {
titleBar.addCenterAction(titleBar.new ViewAction(viewSliding));
}
viewSliding.setVisibility(View.VISIBLE);
if (viewSegment != null) {
viewSegment.setVisibility(View.GONE);
}
} else {
if (center.indexOfChild(viewSegment) == -1) {
titleBar.addCenterAction(titleBar.new ViewAction(viewSegment));
}
viewSegment.setVisibility(View.VISIBLE);
if (viewSliding != null) {
viewSliding.setVisibility(View.GONE);
}
}
}