public void GoogleMobileAds_RemoveBanner() { if( adView != null ) { RunnerActivity.ViewHandler.post( new Runnable() { public void run() { AbsoluteLayout layout = (AbsoluteLayout)RunnerActivity.CurrentActivity.findViewById(R.id.ad); ViewGroup vg = (ViewGroup)layout; if(vg!=null) { vg.removeView( adView ); } adView.destroy(); adView = null; }}); } }
public void GoogleMobileAds_MoveBanner( double _x, double _y ) { Log.i("yoyo", "MoveBanner:" + _x + "," + _y); final int x = (int)_x; final int y = (int)_y; BannerXPos = x; BannerYPos = y; if( adView != null ) { RunnerActivity.ViewHandler.post( new Runnable() { public void run() { if( x < 0 || y < 0) { adView.setVisibility(View.INVISIBLE); } else { AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, x,y ); adView.setLayoutParams( params); adView.requestLayout(); adView.setVisibility(View.VISIBLE); } }}); } }
private View getTouchView(int x, int y) { View v = null; AbsoluteLayout.LayoutParams MinParam = null; for (int i = 0; i < absoluteLayout.getChildCount(); i++) { View view = absoluteLayout.getChildAt(i); AbsoluteLayout.LayoutParams param = (AbsoluteLayout.LayoutParams) view.getLayoutParams(); if (x >= param.x && x <= (param.x + param.width)) if (y >= param.y && y <= (param.y + param.height)) { if (v == null || (MinParam.height * MinParam.width > param.width * param.height)) { v = view; MinParam = param; } } } return v; }
@Override public void run() { AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams( w, h + HEIGHT_PADDING, x, y); if (mTextEdit == null) { mTextEdit = new DummyEdit(getContext()); mLayout.addView(mTextEdit, params); } else { mTextEdit.setLayoutParams(params); } mTextEdit.setVisibility(View.VISIBLE); mTextEdit.requestFocus(); InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mTextEdit, 0); }
public final void addViewToParentAdAPI() { if(parent != null){ final View containerView = parent.getContainerViewAdAPI(); if(containerView != null){ if(containerView instanceof AbsoluteLayout){ AndroidUIUtil.removeFromParent(peer); AbsoluteLayout vg = (AbsoluteLayout)containerView; // LogManager.log("AbsoluteLayout addView for " + this.toString()); final Border border = (parent instanceof JComponent)?((JComponent)parent).getBorder():null; final Insets insets = (border != null)?border.getBorderInsets(parent):null; vg.addView(peer, new AbsoluteLayout.LayoutParams(width, height, x - ((insets != null)?insets.left:0), y - ((insets != null)?insets.top:0))); }else if(containerView instanceof HCTabHost){ //view已加入,不用处理 } } } }
private void updateBubbleSize() { int oldWidth = mBubbleWidth; int oldHeight = mBubbleHeight; mBubbleWidth = (int) Math.max(mBubbleMinWidth, Integer.toString(mEnd).length() * mCharWidth + LayoutUtils.dp2pix(mContext, 8)); mBubbleHeight = (int) Math.max(mBubbleMinHeight, mCharHeight + LayoutUtils.dp2pix(mContext, 8)); if (oldWidth != mBubbleWidth && oldHeight != mBubbleHeight) { //noinspection deprecation AbsoluteLayout.LayoutParams lp = (AbsoluteLayout.LayoutParams) mBubble.getLayoutParams(); lp.width = mBubbleWidth; lp.height = mBubbleHeight; mBubble.setLayoutParams(lp); } }
/** * 給菜單添加標題 * @param title */ public void setTitle(CharSequence title) { if (mListTitle[0] == null || mListTitle[1] == null) { return; } mListTitle[0].setText(title); mListTitle[0].setTextScaleX(0.5f); mListTitle[0].setTextSize(mTextSize); mListTitle[0].setTextColor(mTextColor); // mListTitle[0].setBackgroundResource(R.drawable.popup_list); mListTitle[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, mListTitleHeight, m_cur_lx, m_cur_ly - mListTitleHeight)); mListTitle[1].setText(title); mListTitle[1].setTextScaleX(0.5f); mListTitle[1].setTextSize(mTextSize); mListTitle[1].setTextColor(mTextColor); // mListTitle[1].setBackgroundResource(R.drawable.popup_list); mListTitle[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, mListTitleHeight, m_cur_rx, m_cur_ry - mListTitleHeight)); }
/** * 給菜單添加標題 * @param title */ public void setTitle(int resid) { if (mListTitle[0] == null || mListTitle[1] == null) { return; } mListTitle[0].setText(resid); mListTitle[0].setTextScaleX(0.5f); mListTitle[0].setTextSize(mTextSize); mListTitle[0].setTextColor(mTextColor); mListTitle[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, mListTitleHeight, m_cur_lx, m_cur_ly - mListTitleHeight)); mListTitle[1].setText(resid); mListTitle[1].setTextScaleX(0.5f); mListTitle[1].setTextSize(mTextSize); mListTitle[1].setTextColor(mTextColor); mListTitle[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, mListTitleHeight, m_cur_rx, m_cur_ry - mListTitleHeight)); }
public ViewHolder() { m_listItem_layout = new AbsoluteLayout(CSShareMenu.this.m_context); m_lLayout = new LinearLayout(CSShareMenu.this.m_context); m_appName = new TextView(CSShareMenu.this.m_context); m_icon = new ImageView(CSShareMenu.this.m_context); m_icon.setLayoutParams(new LinearLayout.LayoutParams(m_image_width, m_image_height)); m_appName.setTextSize(22); m_appName.setTextScaleX(0.5f); m_lLayout.setGravity(Gravity.CENTER_VERTICAL); m_lLayout.addView(m_icon); m_lLayout.addView(m_appName); m_lLayout.setLayoutParams(new AbsoluteLayout.LayoutParams(m_shareMenu_width, LayoutParams.WRAP_CONTENT, 0, 0)); m_lLayout.setBackgroundResource(mListLayoutSelector); m_listItem_layout.addView(m_lLayout); }
@Override public void addToLayout(ViewGroup layout) { // TODO Auto-generated method stub if(mToggleButtons[0] == null || mToggleButtons[1] == null){ return; } if(m_is_3D){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ mToggleButtons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); mToggleButtons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ mToggleButtons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); mToggleButtons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } } layout.addView(mToggleButtons[0]); layout.addView(mToggleButtons[1]); }
/** * 設置控件的位置 */ @Override public void setLocation(int x, int y) { super.setLocation(x, y); if(mToggleButtons[0] == null || mToggleButtons[1] == null){ return; } if(mToggleButtons[0].getLayoutParams() != null && mToggleButtons[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ mToggleButtons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); mToggleButtons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ mToggleButtons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); mToggleButtons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } mToggleButtons[0].requestLayout(); mToggleButtons[1].requestLayout(); } }
@SuppressWarnings("deprecation") @Override public void setLocation(int x, int y) { super.setLocation(x, y); if(m_seekBars[0] == null || m_seekBars[1] == null){ return; } if(m_seekBars[0].getLayoutParams() != null && m_seekBars[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_seekBars[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_seekBars[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_seekBars[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_seekBars[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_seekBars[0].requestLayout(); m_seekBars[1].requestLayout(); } }
@SuppressWarnings("deprecation") @Override public void setLocation(int x, int y) { super.setLocation(x, y); if(m_radioButtons[0] == null || m_radioButtons[1] == null){ return; } if(m_radioButtons[0].getLayoutParams() != null && m_radioButtons[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_radioButtons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_radioButtons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_radioButtons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_radioButtons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_radioButtons[0].requestLayout(); m_radioButtons[1].requestLayout(); } }
@Override public void setDimension(boolean is3d) { super.setDimension(is3d); if(m_imageviews[0] == null || m_imageviews[1] == null){ return; } if(m_imageviews[0].getLayoutParams() != null && m_imageviews[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_imageviews[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_imageviews[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_imageviews[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_imageviews[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_imageviews[0].requestLayout(); m_imageviews[1].requestLayout(); } }
@Override public void setLocation(int x, int y) { super.setLocation(x, y); if(m_imageviews[0] == null || m_imageviews[1] == null){ return; } if(m_imageviews[0].getLayoutParams() != null && m_imageviews[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_imageviews[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_imageviews[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_imageviews[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_imageviews[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_imageviews[0].requestLayout(); m_imageviews[1].requestLayout(); } }
@Override public void addToLayout(ViewGroup alayout) { if(m_imageviews[0] == null || m_imageviews[1] == null){ return; } if(alayout == null){ return; } if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_imageviews[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_imageviews[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_imageviews[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_imageviews[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } alayout.addView(m_imageviews[0]); alayout.addView(m_imageviews[1]); }
/** * 設置控件為3D模式 */ @Override public void setDimension(boolean is3d) { super.setDimension(is3d); if(m_buttons[0] == null || m_buttons[1] == null){ return; } if(m_buttons[0].getLayoutParams() != null && m_buttons[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_buttons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_buttons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_buttons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_buttons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_buttons[0].requestLayout(); m_buttons[1].requestLayout(); } }
/** * 設置控件的位置 */ @Override public void setLocation(int x, int y) { super.setLocation(x, y); if(m_buttons[0] == null || m_buttons[1] == null){ return; } if(m_buttons[0].getLayoutParams() != null && m_buttons[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_buttons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_buttons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_buttons[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_buttons[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_buttons[0].requestLayout(); m_buttons[1].requestLayout(); } }
@SuppressWarnings("deprecation") @Override public void setLocation(int x, int y) { super.setLocation(x, y); if(m_gallerys[0] == null || m_gallerys[1] == null){ return; } if(m_gallerys[0].getLayoutParams() != null && m_gallerys[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_gallerys[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_gallerys[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_gallerys[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_gallerys[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_gallerys[0].requestLayout(); m_gallerys[1].requestLayout(); } }
@SuppressWarnings("deprecation") @Override public void setDimension(boolean is3d) { super.setDimension(is3d); if(m_progressBars[0] == null || m_progressBars[1] == null){ return; } if(m_progressBars[0].getLayoutParams() != null && m_progressBars[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_progressBars[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_progressBars[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_progressBars[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_progressBars[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_progressBars[0].requestLayout(); m_progressBars[1].requestLayout(); } }
@SuppressWarnings("deprecation") @Override public void setLocation(int x, int y) { super.setLocation(x, y); if(m_progressBars[0] == null || m_progressBars[1] == null){ return; } if(m_progressBars[0].getLayoutParams() != null && m_progressBars[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_progressBars[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_progressBars[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_progressBars[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_progressBars[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_progressBars[0].requestLayout(); m_progressBars[1].requestLayout(); } }
/** * 將控件添加到layout中去 */ @SuppressWarnings("deprecation") @Override public void addToLayout(ViewGroup alayout) { if(m_progressBars[0] == null || m_progressBars[1] == null){ return; } if(alayout == null){ return; } //設置控件在屏幕中顯示的位置 if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_progressBars[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_progressBars[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_progressBars[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_progressBars[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } alayout.addView(m_progressBars[0]); alayout.addView(m_progressBars[1]); }
@SuppressWarnings("deprecation") @Override public void setLocation(int x, int y) { super.setLocation(x, y); if(m_textViews[0] == null || m_textViews[1] == null){ return; } if(m_textViews[0].getLayoutParams() != null && m_textViews[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_textViews[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_textViews[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_textViews[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_textViews[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_textViews[0].requestLayout(); m_textViews[1].requestLayout(); } }
@SuppressWarnings("deprecation") @Override public void setLocation(int x, int y) { super.setLocation(x, y); if(m_checkboxs[0] == null || m_checkboxs[1] == null){ return; } if(m_checkboxs[0].getLayoutParams() != null && m_checkboxs[1].getLayoutParams() != null){ if(m_cur_width == WRAP_CONTENT || m_cur_height == WRAP_CONTENT){ m_checkboxs[0].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_lx, m_cur_ly)); m_checkboxs[1].setLayoutParams(new AbsoluteLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, m_cur_rx, m_cur_ry)); }else{ m_checkboxs[0].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_lx, m_cur_ly)); m_checkboxs[1].setLayoutParams(new AbsoluteLayout.LayoutParams(m_cur_width, m_cur_height, m_cur_rx, m_cur_ry)); } m_checkboxs[0].requestLayout(); m_checkboxs[1].requestLayout(); } }
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int count = getElementCount(); int maxHeight = 0; int maxWidth = 0; measureChildren(widthMeasureSpec, heightMeasureSpec); for (int i = 0; i < count; i++) { UIElement child = getElementAt(i); if (child.getVisibility() != View.GONE) { int childRight; int childBottom; AbsoluteLayout.LayoutParams lp = (AbsoluteLayout.LayoutParams) child.getLayoutParams(); childRight = lp.x + child.getMeasuredWidth(); childBottom = lp.y + child.getMeasuredHeight(); maxWidth = Math.max(maxWidth, childRight); maxHeight = Math.max(maxHeight, childBottom); } } maxWidth += getPaddingLeft() + getPaddingRight(); maxHeight += getPaddingTop() + getPaddingBottom(); setMeasuredDimension(resolveSize(maxWidth, widthMeasureSpec), resolveSize(maxHeight, heightMeasureSpec)); }
@Override protected void onLayout(int left, int top, int right, int bottom) { int count = getElementCount(); for (int i = 0; i < count; i++) { UIElement child = getElementAt(i); if (child.getVisibility() != View.GONE) { AbsoluteLayout.LayoutParams lp = (AbsoluteLayout.LayoutParams) child.getLayoutParams(); int childLeft = getPaddingLeft() + lp.x; int childTop = getPaddingTop() + lp.y; child.layout(childLeft, childTop, childLeft + child.getMeasuredWidth(), childTop + child.getMeasuredHeight()); } } }
@Override protected void onCreate(Bundle savedInstanceState) { Log.v("SDL", "onCreate():" + mSingleton); super.onCreate(savedInstanceState); SDLActivity.initialize(); // So we can call stuff from static callbacks mSingleton = this; // Set up the surface mSurface = new SDLSurface(getApplication()); if(Build.VERSION.SDK_INT >= 12) { mJoystickHandler = new SDLJoystickHandler_API12(); } else { mJoystickHandler = new SDLJoystickHandler(); } mLayout = new AbsoluteLayout(this); mLayout.addView(mSurface); setContentView(mLayout); }
@Override public void enableCameraView() { // Start listening for orientation events mCameraOrientationEventListener = new OrientationEventListener(this) { @Override public void onOrientationChanged(int orientation) { if (mAppStateListeners != null) { for (GeckoAppShell.AppStateListener listener: mAppStateListeners) { listener.onOrientationChanged(); } } } }; mCameraOrientationEventListener.enable(); // Try to make it fully transparent. if (mCameraView instanceof SurfaceView) { if (Versions.feature11Plus) { mCameraView.setAlpha(0.0f); } ViewGroup mCameraLayout = (ViewGroup) findViewById(R.id.camera_layout); // Some phones (eg. nexus S) need at least a 8x16 preview size mCameraLayout.addView(mCameraView, new AbsoluteLayout.LayoutParams(8, 16, 0, 0)); } }
public PictureLayout(InflateView context,boolean Create) { super(context); mMainView = (InflateView) context; btnCamera = new Button(context); btnCamera.setText(""); //btnCamera.setBackgroundColor(Color.RED); btnCamera.setGravity(Gravity.CENTER); btnCamera.setLayoutParams(new AbsoluteLayout.LayoutParams(100, 100, 100, 100)); btnCamera.setVisibility(1); addView(btnCamera); loadit ld = new loadit(); if (Create) { Dialog dg = mMainView.CreateDialog(mMainView.DIALOG_LOAD_FILE, ".jpg", ld); } }
@Override protected void onCreate(Bundle savedInstanceState) { //Log.v("SDL", "onCreate()"); super.onCreate(savedInstanceState); // So we can call stuff from static callbacks mSingleton = this; // Set up the surface mSurface = new SDLSurface(getApplication()); mLayout = new AbsoluteLayout(this); mLayout.addView(mSurface); setContentView(mLayout); }
@Override protected void onCreate(Bundle savedInstanceState) { //Log.v("SDL", "onCreate()"); super.onCreate(savedInstanceState); // So we can call stuff from static callbacks mSingleton = this; // Set up the surface mSurface = new SDLSurface(getApplication()); // Make sure this variable is initialized here! mExitCalledFromJava = false; if(Build.VERSION.SDK_INT >= 12) { mJoystickHandler = new SDLJoystickHandler_API12(); } else { mJoystickHandler = new SDLJoystickHandler(); } mLayout = new AbsoluteLayout(this); mLayout.addView(mSurface); setContentView(mLayout); }
/** * Method to set the view's height dynamically according to screen size. */ private void setViewsHeightDynamically() { if (m_absHeight <= 500) { m_layoutparamsDelete = new AbsoluteLayout.LayoutParams(20, 20, 110, 0); m_layoutParamsEdit = new AbsoluteLayout.LayoutParams(20, 20, 110, 110); m_deleteEditHeightwidth = 20; } else if (m_absHeight >= 900) { m_layoutparamsDelete = new AbsoluteLayout.LayoutParams(40, 40, 130, 0); m_layoutParamsEdit = new AbsoluteLayout.LayoutParams(40, 40, 130, 130); m_deleteEditHeightwidth = 40; } else { m_layoutparamsDelete = new AbsoluteLayout.LayoutParams(35, 35, 140, 0); m_layoutParamsEdit = new AbsoluteLayout.LayoutParams(35, 35, 120, 120); m_deleteEditHeightwidth = 35; } }
private void init(final Context context) { for (ViewDumper.ViewItem item : list) { TextView tv = new TextView(context); tv.setTag(item); //红框 GradientDrawable redBounds = new GradientDrawable(); redBounds.setStroke(2, Color.RED); redBounds.setColor(Color.TRANSPARENT); tv.setBackgroundDrawable(redBounds); AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(item.wh.x, item.wh.y, item.bounds.x, item.bounds.y - getStatusBarHeight()); absoluteLayout.addView(tv, layoutParams); } }
@Override protected View onCreateView(Context context) { absoluteLayout = new AbsoluteLayout(context); GradientDrawable gd = new GradientDrawable(); gd.setStroke(4, Color.RED); absoluteLayout.setBackgroundDrawable(gd); return absoluteLayout; }