当前位置: 首页>>代码示例>>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;未经允许,请勿转载。