當前位置: 首頁>>代碼示例>>Java>>正文


Java LinearLayout.indexOfChild方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:jakebonk,項目名稱:BoardView,代碼行數:16,代碼來源:BoardView.java

示例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);
        }
    }
}
 
開發者ID:AriesHoo,項目名稱:FastLib,代碼行數:30,代碼來源:ActivityFragment.java


注:本文中的android.widget.LinearLayout.indexOfChild方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。