本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
}
});
}
示例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();
}
示例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.");
}
}
示例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;
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例14: forceRemoveView
import android.view.ViewGroup; //导入方法依赖的package包/类
private void forceRemoveView(BackStackNode backStackNode, ViewGroup viewGroup){
ViewGroup parent = (ViewGroup) viewGroup.getParent();
parent.removeView(viewGroup);
}