Java Code Examples for android.widget.FrameLayout#getChildAt()
The following examples show how to use
android.widget.FrameLayout#getChildAt() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnimatedDoorActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(layoutResId()); FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content); View parent = activityRoot.getChildAt(0); // better way ? mAnimated = new AnimatedDoorLayout(this); activityRoot.removeView(parent); activityRoot.addView(mAnimated, parent.getLayoutParams()); mAnimated.addView(parent); mDoorType = getIntent().getIntExtra("door_type", AnimatedDoorLayout.HORIZONTAL_DOOR); mAnimated.setDoorType(mDoorType); ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_DOOR_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600); animator.start(); }
Example 2
Source File: AndroidBug5497Workaround.java From RxTools-master with Apache License 2.0 | 6 votes |
private AndroidBug5497Workaround(Activity activity) { //获取状态栏的高度 int resourceId = activity.getResources().getIdentifier("status_bar_height", "dimen", "android"); statusBarHeight = activity.getResources().getDimensionPixelSize(resourceId); this.activity = activity; FrameLayout content = (FrameLayout)activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); //界面出现变动都会调用这个监听事件 mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { public void onGlobalLayout() { if (isfirst) { contentHeight = mChildOfContent.getHeight();//兼容华为等机型 isfirst = false; } possiblyResizeChildOfContent(); } }); frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams(); }
Example 3
Source File: BaseActivity.java From NMSAlphabetAndroidApp with MIT License | 6 votes |
protected void adjustMarginAndPadding(){ FrameLayout contentLayout = (FrameLayout) findViewById(R.id.content_layout); if(contentLayout != null){ if(Build.VERSION.SDK_INT >= 23) { contentLayout.setPaddingRelative(0, contentLayout.getPaddingTop(), 0, Util.getNavigationBarHeight(this)); } else if(Build.VERSION.SDK_INT == 18){ contentLayout.setPaddingRelative(0, 0, 0, 0); if(this instanceof SettingsActivity){ LinearLayout childView = (LinearLayout) contentLayout.getChildAt(0); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) childView.getLayoutParams(); params.topMargin = params.bottomMargin; childView.setLayoutParams(params); } } } }
Example 4
Source File: KeyboardUtils.java From AndroidUtilCode with Apache License 2.0 | 6 votes |
/** * Fix the bug of 5497 in Android. * <p>It will clean the adjustResize</p> * * @param window The window. */ public static void fixAndroidBug5497(@NonNull final Window window) { int softInputMode = window.getAttributes().softInputMode; window.setSoftInputMode(softInputMode & ~WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); final FrameLayout contentView = window.findViewById(android.R.id.content); final View contentViewChild = contentView.getChildAt(0); final int paddingBottom = contentViewChild.getPaddingBottom(); final int[] contentViewInvisibleHeightPre5497 = {getContentViewInvisibleHeight(window)}; contentView.getViewTreeObserver() .addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { int height = getContentViewInvisibleHeight(window); if (contentViewInvisibleHeightPre5497[0] != height) { contentViewChild.setPadding( contentViewChild.getPaddingLeft(), contentViewChild.getPaddingTop(), contentViewChild.getPaddingRight(), paddingBottom + getDecorViewInvisibleHeight(window) ); contentViewInvisibleHeightPre5497[0] = height; } } }); }
Example 5
Source File: AnimatedRectActivity.java From UltimateAndroid with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(layoutResId()); FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content); View parent = activityRoot.getChildAt(0); // better way ? mAnimated = new AnimatedRectLayout(this); activityRoot.removeView(parent); activityRoot.addView(mAnimated, parent.getLayoutParams()); mAnimated.addView(parent); mAnimationType = getIntent().getIntExtra("animation_type", AnimatedRectLayout.ANIMATION_RANDOM); mAnimated.setAnimationType(mAnimationType); ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_RECT_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600); animator.start(); }
Example 6
Source File: AbstractTreeViewAdapter.java From satstat with GNU General Public License v3.0 | 6 votes |
@Override public final View getView(final int position, final View convertView, final ViewGroup parent) { //Log.d(TAG, "Creating a view based on " + convertView // + " with position " + position); final TreeNodeInfo<T> nodeInfo = getTreeNodeInfo(position); if (convertView == null) { //Log.d(TAG, "Creating the view a new"); final LinearLayout layout = (LinearLayout) layoutInflater.inflate( getTreeListItemWrapperId(), null); return populateTreeItem(layout, getNewChildView(nodeInfo), nodeInfo, true); } else { //Log.d(TAG, "Reusing the view"); final LinearLayout linear = (LinearLayout) convertView; final FrameLayout frameLayout = (FrameLayout) linear .findViewById(R.id.treeview_list_item_frame); final View childView = frameLayout.getChildAt(0); updateView(childView, nodeInfo); return populateTreeItem(linear, childView, nodeInfo, false); } }
Example 7
Source File: WebViewActivity.java From YCWebView with Apache License 2.0 | 5 votes |
private AndroidBug5497Workaround(Activity activity) { this.activity = activity; FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { possiblyResizeChildOfContent(); } }); frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams(); }
Example 8
Source File: IFrameTest.java From cordova-amazon-fireos with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { super.setUp(); mInstr = this.getInstrumentation(); testActivity = this.getActivity(); containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); innerContainer = (LinearLayout) containerView.getChildAt(0); testView = (CordovaWebView) innerContainer.getChildAt(0); touch = new TouchUtils(); touchTool = new Purity(testActivity, getInstrumentation()); }
Example 9
Source File: Bulletin.java From Telegram with GNU General Public License v2.0 | 5 votes |
public static Bulletin find(@NonNull FrameLayout containerLayout) { for (int i = 0, size = containerLayout.getChildCount(); i < size; i++) { final View view = containerLayout.getChildAt(i); if (view instanceof Layout) { return ((Layout) view).bulletin; } } return null; }
Example 10
Source File: ChartProgressBar.java From ChartProgressBar-Android with Apache License 2.0 | 5 votes |
public void removeBarValues() { if (oldFrameLayout != null) removeClickedBar(); final int barsCount = ((LinearLayout) this.getChildAt(0)).getChildCount(); for (int i = 0; i < barsCount; i++) { FrameLayout rootFrame = (FrameLayout) ((LinearLayout) this.getChildAt(0)).getChildAt(i); int rootChildCount = rootFrame.getChildCount(); for (int j = 0; j < rootChildCount; j++) { View childView = rootFrame.getChildAt(j); if (childView instanceof LinearLayout) { //bar LinearLayout barContainerLinear = ((LinearLayout) childView); int barContainerCount = barContainerLinear.getChildCount(); for (int k = 0; k < barContainerCount; k++) { View view = barContainerLinear.getChildAt(k); if (view instanceof Bar) { BarAnimation anim = new BarAnimation(((Bar) view), (int) (mDataList.get(i).getBarValue() * 100), 0); anim.setDuration(250); ((Bar) view).startAnimation(anim); } } } } } isBarsEmpty = true; }
Example 11
Source File: HtmlNotFoundTest.java From crosswalk-cordova-android with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception { super.setUp(); testActivity = this.getActivity(); containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); innerContainer = (LinearLayout) containerView.getChildAt(0); testView = (CordovaWebView) innerContainer.getChildAt(0); }
Example 12
Source File: MultiVideoCallActivity.java From sealtalk-android with MIT License | 5 votes |
@Override public void onRemoteUserLeft(String userId, RongCallCommon.CallDisconnectedReason reason) { //incoming状态,localViewUserId为空 if (localViewUserId == null) return; if (localViewUserId.equals(userId)) { localViewContainer.removeAllViews(); String currentUserId = RongIMClient.getInstance().getCurrentUserId(); FrameLayout remoteVideoView = (FrameLayout) remoteViewContainer.findViewWithTag(currentUserId); localView = (SurfaceView) remoteVideoView.getChildAt(0); remoteVideoView.removeAllViews(); localViewContainer.addView(localView); TextView topUserNameView = (TextView) topContainer.findViewById(R.id.rc_voip_user_name); UserInfo userInfo = RongContext.getInstance().getUserInfoFromCache(currentUserId); if (userInfo != null) { topUserNameView.setText(userInfo.getName()); } else { topUserNameView.setText(currentUserId); } localViewUserId = currentUserId; } View singleRemoteView = remoteViewContainer.findViewWithTag(userId + "view"); if (singleRemoteView == null) return; LinearLayout container = (LinearLayout) singleRemoteView.getParent(); container.removeView(singleRemoteView); if (container.equals(remoteViewContainer2)) { if (remoteViewContainer1.getChildCount() > 0) { View childView = remoteViewContainer1.getChildAt(0); remoteViewContainer1.removeView(childView); remoteViewContainer2.addView(childView); } } }
Example 13
Source File: PluginManagerTest.java From cordova-android-chromeview with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception{ super.setUp(); testActivity = this.getActivity(); containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); innerContainer = (LinearLayout) containerView.getChildAt(0); testView = innerContainer.getChildAt(0); }
Example 14
Source File: GapClientTest.java From cordova-android-chromeview with Apache License 2.0 | 5 votes |
protected void setUp() throws Exception{ super.setUp(); testActivity = this.getActivity(); containerView = (FrameLayout) testActivity.findViewById(android.R.id.content); innerContainer = (LinearLayout) containerView.getChildAt(0); testView = innerContainer.getChildAt(0); }
Example 15
Source File: ViewUtils.java From Android-utils with Apache License 2.0 | 5 votes |
private static int getContentViewInvisibleHeight(final Activity activity) { final FrameLayout contentView = activity.findViewById(android.R.id.content); final View contentViewChild = contentView.getChildAt(0); final Rect outRect = new Rect(); contentViewChild.getWindowVisibleDisplayFrame(outRect); Log.d("KeyboardUtils", "getContentViewInvisibleHeight: " + (contentViewChild.getBottom() - outRect.bottom)); return contentViewChild.getBottom() - outRect.bottom; }
Example 16
Source File: RNShineButton.java From react-native-shine-button with Apache License 2.0 | 4 votes |
@ReactProp(name = "color") public void setColor(FrameLayout shineButtonFrame, String color) { ShineButton shineButton = (ShineButton) shineButtonFrame.getChildAt(0); shineButton.setBtnColor(Color.parseColor(color)); }
Example 17
Source File: KeyboardDismisser.java From keyboard-dismisser with Apache License 2.0 | 4 votes |
public static void useWith(Activity activity) { FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content); ViewGroup viewGroup = (ViewGroup) content.getChildAt(0); swapMainLayoutWithDismissingLayout(viewGroup, activity); }
Example 18
Source File: RNDownloadButton.java From react-native-download-button with MIT License | 4 votes |
@ReactProp(name = "backgroundColor") public void setBackgroundColor(FrameLayout downloadButtonFrame, String backgroundColor) { ArrowDownloadButton downloadButton = (ArrowDownloadButton) downloadButtonFrame.getChildAt(0); downloadButton.setBackgroundColor(Color.parseColor(backgroundColor)); }
Example 19
Source File: RNDownloadButton.java From react-native-download-button with MIT License | 4 votes |
@ReactProp(name = "tintColor") public void setTintColor(FrameLayout downloadButtonFrame, String tintColor) { ArrowDownloadButton downloadButton = (ArrowDownloadButton) downloadButtonFrame.getChildAt(0); // downloadButton.setBackgroundColor(Color.parseColor(tintColor)); }
Example 20
Source File: RNDownloadButton.java From react-native-download-button with MIT License | 4 votes |
@ReactProp(name = "reset") public void setReset(FrameLayout downloadButtonFrame, boolean reset) { ArrowDownloadButton downloadButton = (ArrowDownloadButton) downloadButtonFrame.getChildAt(0); if (reset) downloadButton.reset(); }