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


Java ViewGroup.getParent方法代碼示例

本文整理匯總了Java中android.view.ViewGroup.getParent方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewGroup.getParent方法的具體用法?Java ViewGroup.getParent怎麽用?Java ViewGroup.getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ViewGroup的用法示例。


在下文中一共展示了ViewGroup.getParent方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initEventAndData

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
protected void initEventAndData() {
    if (getView() == null)
        return;
    viewMain = (ViewGroup) getView().findViewById(R.id.view_main);
    if (viewMain == null) {
        throw new IllegalStateException(
                "The subclass of RootActivity must contain a View named 'view_main'.");
    }
    if (!(viewMain.getParent() instanceof ViewGroup)) {
        throw new IllegalStateException(
                "view_main's ParentView should be a ViewGroup.");
    }
    mParent = (ViewGroup) viewMain.getParent();
    View.inflate(mContext, R.layout.view_progress, mParent);
    viewLoading = mParent.findViewById(R.id.view_loading);
    ivLoading = (ProgressImageView) viewLoading.findViewById(R.id.iv_progress);
    viewLoading.setVisibility(View.GONE);
    viewMain.setVisibility(View.VISIBLE);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:RootFragment.java

示例2: initEventAndData

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
protected void initEventAndData() {
    viewMain = (ViewGroup) findViewById(R.id.view_main);
    if (viewMain == null) {
        throw new IllegalStateException(
                "The subclass of RootActivity must contain a View named 'view_main'.");
    }
    if (!(viewMain.getParent() instanceof ViewGroup)) {
        throw new IllegalStateException(
                "view_main's ParentView should be a ViewGroup.");
    }
    mParent = (ViewGroup) viewMain.getParent();
    View.inflate(mContext, R.layout.view_progress, mParent);
    viewLoading = mParent.findViewById(R.id.view_loading);
    ivLoading = (ProgressImageView) viewLoading.findViewById(R.id.iv_progress);
    viewLoading.setVisibility(View.GONE);
    viewMain.setVisibility(View.VISIBLE);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:RootActivity.java

示例3: onCommentItemClick

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
public void onCommentItemClick(View view, String id, int shareMessagePosition, int position, String replyUser) {
        LogUtil.e("位置" + shareMessagePosition);
        currentPosition = shareMessagePosition;
        currentCommentPosition = position;
        ViewParent viewParent = view.getParent();
        if (viewParent != null) {
                ViewGroup parent = (ViewGroup) viewParent;
                commentItemOffset += parent.getHeight() - view.getBottom();
                if (parent.getParent() != null) {
                        ViewGroup rootParent = (ViewGroup) parent.getParent();
                        commentItemOffset += rootParent.getHeight() + parent.getBottom();
                }
        }
        this.replyUid = replyUser;
        dealBottomView(true);
}
 
開發者ID:HelloChenJinJun,項目名稱:TestChat,代碼行數:18,代碼來源:ShareMessageFragment.java

示例4: onCommentItemClick

import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
public void onCommentItemClick(View view, String id, int shareMessagePosition, int commentPosition, String replyUid) {
        LogUtil.e("位置" + shareMessagePosition);
        currentPosition = shareMessagePosition;
        currentCommentPosition = commentPosition;
        ViewParent viewParent = view.getParent();
        if (viewParent != null) {
                ViewGroup parent = (ViewGroup) viewParent;
                commentItemOffset += parent.getHeight() - view.getBottom();
                if (parent.getParent() != null) {
                        ViewGroup rootParent = (ViewGroup) parent.getParent();
                        commentItemOffset += rootParent.getHeight() + parent.getBottom();
                }
        }
        this.replyUid = replyUid;
        dealBottomView(true);
}
 
開發者ID:HelloChenJinJun,項目名稱:TestChat,代碼行數:18,代碼來源:UserDetailActivity.java

示例5: attachToActivity

import android.view.ViewGroup; //導入方法依賴的package包/類
/**
 * 將SwipeFinishLayout關聯到指定activity中
 * @param activity
 */
public void attachToActivity(Activity activity) {
    mActivity = activity;
    TypedArray ta = activity.getTheme().obtainStyledAttributes(
            new int[] {android.R.attr.windowBackground});
    int background = ta.getResourceId(0, 0);
    ta.recycle();

    // 設置window樣式,FEATURE_NO_TITLE
    activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
    ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    // 係統內置,/platforms/android-25/data/res/layout/screen_custom_title.xml
    ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);
    decorChild.setBackgroundResource(background);
    decorView.removeView(decorChild);
    addView(decorChild);
    // 設置content view
    mContentView = (View) decorChild.getParent();
    // 將SwipeFinishLayout添加到decorView中
    decorView.addView(this);
}
 
開發者ID:lorienzhang,項目名稱:SwipeFinishLayout,代碼行數:25,代碼來源:SwipeFinishLayout.java

示例6: remove

import android.view.ViewGroup; //導入方法依賴的package包/類
public void remove() {
    if (getParent() == null || _labelViewContainerID == -1) {
        return;
    }

    ViewGroup frameContainer = (ViewGroup) getParent();
    assert (frameContainer.getChildCount() == 2);
    View target = frameContainer.getChildAt(0);

    ViewGroup parentContainer = (ViewGroup) frameContainer.getParent();
    int groupIndex = parentContainer.indexOfChild(frameContainer);
    if (frameContainer.getParent() instanceof RelativeLayout) {
        for (int i = 0; i < parentContainer.getChildCount(); i++) {
            if (i == groupIndex) {
                continue;
            }
            View view = parentContainer.getChildAt(i);
            RelativeLayout.LayoutParams para = (RelativeLayout.LayoutParams) view.getLayoutParams();
            for (int j = 0; j < para.getRules().length; j++) {
                if (para.getRules()[j] == _labelViewContainerID) {
                    para.getRules()[j] = target.getId();
                }
            }
            view.setLayoutParams(para);
        }
    }

    ViewGroup.LayoutParams frameLayoutParam = frameContainer.getLayoutParams();
    target.setLayoutParams(frameLayoutParam);
    parentContainer.removeViewAt(groupIndex);
    frameContainer.removeView(target);
    frameContainer.removeView(this);
    parentContainer.addView(target,groupIndex);
    _labelViewContainerID = -1;
}
 
開發者ID:open-android,項目名稱:labelview,代碼行數:36,代碼來源:LabelView.java

示例7: AccountCreationWebview

import android.view.ViewGroup; //導入方法依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
public AccountCreationWebview(BasePrefsWizard aParent, String url, OnAccountCreationDoneListener l){
    parent = aParent;
    creationListener = l;
    webCreationPage = url;
    
    settingsContainer = (ViewGroup) parent.findViewById(R.id.settings_container);
    validationBar = (ViewGroup) parent.findViewById(R.id.validation_bar);
    
    ViewGroup globalContainer = (ViewGroup) settingsContainer.getParent();
    
    parent.getLayoutInflater().inflate(R.layout.wizard_account_creation_webview, globalContainer);
    
    webView = (WebView) globalContainer.findViewById(R.id.webview);
    loadingProgressBar = (ProgressBar) globalContainer.findViewById(R.id.webview_progress);
    
    WebSettings webSettings = webView.getSettings();
    webSettings.setSavePassword(false);
    webSettings.setSaveFormData(false);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setSupportZoom(false);
    webSettings.setCacheMode(WebSettings.LOAD_NORMAL);
    webSettings.setNeedInitialFocus(true);
    webView.addJavascriptInterface(new JSInterface(), "CSipSimpleWizard");
    
    // Adds Progress bar Support
    webView.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress) {
            if(progress < 100) {
                loadingProgressBar.setVisibility(View.VISIBLE);
                loadingProgressBar.setProgress(progress); 
            }else {
                loadingProgressBar.setVisibility(View.GONE);
            }
        }
    });
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:38,代碼來源:AccountCreationWebview.java

示例8: measureViewGroupHeight

import android.view.ViewGroup; //導入方法依賴的package包/類
private static int measureViewGroupHeight(ViewGroup viewGroup) {
    View parent = (View) viewGroup.getParent();
    int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(
            parent.getMeasuredWidth() - parent.getPaddingLeft() - parent.getPaddingRight(),
            View.MeasureSpec.AT_MOST);
    int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    viewGroup.measure(widthMeasureSpec, heightMeasureSpec);
    return viewGroup.getMeasuredHeight();
}
 
開發者ID:HanyeeWang,項目名稱:GeekZone,代碼行數:10,代碼來源:DragUtils.java

示例9: addAppToIconSheet

import android.view.ViewGroup; //導入方法依賴的package包/類
private void addAppToIconSheet(GridLayout iconSheet, AppLauncher app, int pos, boolean reuse) {
    if (app != null) {
        try {
            if ((app.isWidget() && isAppInstalled(app.getPackageName())) || mLaunchApp.isValidActivity(app)) {
                ViewGroup item = getLauncherView(app, false, reuse);
                if (item != null) {
                    if (!app.iconLoaded()) {
                        app.loadAppIconAsync(this, mPackageMan);
                    }
                    ViewGroup parent = (ViewGroup) item.getParent();
                    if (parent != null) parent.removeView(item);
                    GridLayout.LayoutParams lp = getAppLauncherLayoutParams(iconSheet, app);
                    iconSheet.addView(item, pos, lp);
                    return;
                }
            } else {
                db().deleteApp(app.getComponentName());
                Log.d(TAG, "removed " + app.getPackageName() + " " + app.getActivityName() + ":activity not valid.");
            }
        } catch (Exception e) {
            Log.e(TAG, "exception adding icon to sheet", e);
            Toast.makeText(this,"Couldn't place icon: " + e.getMessage(), Toast.LENGTH_LONG).show();
        }
    } else {
        Log.d(TAG, "Not showing recent: Null.");
    }

}
 
開發者ID:quaap,項目名稱:LaunchTime,代碼行數:29,代碼來源:MainActivity.java

示例10: remove

import android.view.ViewGroup; //導入方法依賴的package包/類
public void remove() {
    if (this.mHightLightView != null) {
        ViewGroup parent = (ViewGroup) this.mHightLightView.getParent();
        if ((parent instanceof RelativeLayout) || (parent instanceof FrameLayout)) {
            parent.removeView(this.mHightLightView);
        } else {
            parent.removeView(this.mHightLightView);
            View origin = parent.getChildAt(0);
            ViewGroup graParent = (ViewGroup) parent.getParent();
            graParent.removeView(parent);
            graParent.addView(origin, parent.getLayoutParams());
        }
        this.mHightLightView = null;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:16,代碼來源:HighLight.java

示例11: insertTabs

import android.view.ViewGroup; //導入方法依賴的package包/類
private void insertTabs(ViewGroup container) {
    View rootView = (View) container.getParent();
    appBar = (AppBarLayout) rootView.findViewById(R.id.appbar);
    tabs = new TabLayout(getActivity());
    tabs.setTabTextColors(Color.parseColor("#FFFFFF"), Color.parseColor("#FFFFFF"));
    appBar.addView(tabs);
}
 
開發者ID:kflauri2312lffds,項目名稱:Android_watch_magpie,代碼行數:8,代碼來源:PhysioParamFragment.java

示例12: setBarVisible

import android.view.ViewGroup; //導入方法依賴的package包/類
protected void setBarVisible(ViewGroup barLayout, boolean visible) {
    if (barLayout.getId() == R.id.document__fragment__edit__textmodule_actions_bar && barLayout.getParent() instanceof HorizontalScrollView) {
        ((HorizontalScrollView) barLayout.getParent())
                .setVisibility(visible ? View.VISIBLE : View.GONE);
    }
}
 
開發者ID:gsantner,項目名稱:markor,代碼行數:7,代碼來源:TextModuleActions.java

示例13: removeView

import android.view.ViewGroup; //導入方法依賴的package包/類
private void removeView(BackStackNode backStackNode, ViewGroup viewGroup){
    if (!backStackNode.shouldRetain){
        ViewGroup parent = (ViewGroup) viewGroup.getParent();
        parent.removeView(viewGroup);
    }
}
 
開發者ID:kevinwang5658,項目名稱:backstack,代碼行數:7,代碼來源:LinearBackStack.java

示例14: forceRemoveView

import android.view.ViewGroup; //導入方法依賴的package包/類
private void forceRemoveView(BackStackNode backStackNode, ViewGroup viewGroup){
    ViewGroup parent = (ViewGroup) viewGroup.getParent();
    parent.removeView(viewGroup);
}
 
開發者ID:kevinwang5658,項目名稱:backstack,代碼行數:5,代碼來源:LinearBackStack.java


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