本文整理匯總了Java中android.widget.AbsoluteLayout.LayoutParams方法的典型用法代碼示例。如果您正苦於以下問題:Java AbsoluteLayout.LayoutParams方法的具體用法?Java AbsoluteLayout.LayoutParams怎麽用?Java AbsoluteLayout.LayoutParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.AbsoluteLayout
的用法示例。
在下文中一共展示了AbsoluteLayout.LayoutParams方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTouchView
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
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;
}
示例2: run
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
@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);
}
示例3: updateBubbleSize
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
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);
}
}
示例4: onMeasure
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
@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));
}
示例5: onLayout
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
@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());
}
}
}
示例6: setViewsHeightDynamically
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
/**
* 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;
}
}
示例7: init
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
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);
}
}
示例8: onScrollChanged
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
protected void onScrollChanged(int i, int i2, int i3, int i4) {
AbsoluteLayout.LayoutParams layoutParams = (AbsoluteLayout.LayoutParams) this.d
.getLayoutParams();
layoutParams.x = i;
layoutParams.y = i2;
this.d.setLayoutParams(layoutParams);
super.onScrollChanged(i, i2, i3, i4);
}
示例9: letakkanPanah
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
protected void letakkanPanah() {
float y = this.ukuranUiPx - (this.hue * this.ukuranUiPx / 360.f);
if (y == this.ukuranUiPx) {
y = 0.f;
}
AbsoluteLayout.LayoutParams layoutParams = (AbsoluteLayout.LayoutParams) this.panah
.getLayoutParams();
layoutParams.y = (int) (y + 4);
this.panah.setLayoutParams(layoutParams);
}
示例10: letakkanKeker
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
protected void letakkanKeker() {
float x = this.sat * this.ukuranUiPx;
float y = (1.f - this.val) * this.ukuranUiPx;
AbsoluteLayout.LayoutParams layoutParams = (AbsoluteLayout.LayoutParams) this.viewKeker
.getLayoutParams();
layoutParams.x = (int) (x + 3);
layoutParams.y = (int) (y + 3);
this.viewKeker.setLayoutParams(layoutParams);
}
示例11: closeBookAnimation
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
public void closeBookAnimation() {
if (mIsOpen && wmRootView!=null) {
//因為書本打開後會移動到第一位置,所以要設置新的位置參數
contentAnimation.setmPivotXValue(bookShelf.getFirstLocation()[0]);
contentAnimation.setmPivotYValue(bookShelf.getFirstLocation()[1]);
coverAnimation.setmPivotXValue(bookShelf.getFirstLocation()[0]);
coverAnimation.setmPivotYValue(bookShelf.getFirstLocation()[1]);
AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(
itemTextView.getLayoutParams());
params.x = bookShelf.getFirstLocation()[0];
params.y = bookShelf.getFirstLocation()[1];//firstLocation[1]在滑動的時候回改變,所以要在dispatchDraw的時候獲取該位置值
wmRootView.updateViewLayout(cover,params);
wmRootView.updateViewLayout(content,params);
//動畫逆向運行
if (!contentAnimation.getMReverse()) {
contentAnimation.reverse();
}
if (!coverAnimation.getMReverse()) {
coverAnimation.reverse();
}
//清除動畫再開始動畫
content.clearAnimation();
content.startAnimation(contentAnimation);
cover.clearAnimation();
cover.startAnimation(coverAnimation);
}
}
示例12: initLayout
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
private void initLayout() {
AbsoluteLayout layout = new AbsoluteLayout(this);
TextView lblAdress = new TextView(this);
AbsoluteLayout.LayoutParams p = new AbsoluteLayout.LayoutParams(
AbsoluteLayout.LayoutParams.WRAP_CONTENT, LINE_HEIGHT, INSETS, INSETS);
lblAdress.setLayoutParams(p);
lblAdress.setText("IP Address");
layout.addView(lblAdress);
TextView lblAccelerometer = new TextView(this);
p = new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT, LINE_HEIGHT,
INSETS, 3 * INSETS);
lblAccelerometer.setLayoutParams(p);
lblAccelerometer.setText("Accelerometer");
layout.addView(lblAccelerometer);
edtIpAddress = new EditText(this);
edtIpAddress.setTextSize(12.0f);
p = new AbsoluteLayout.LayoutParams(IP_WIDTH, AbsoluteLayout.LayoutParams.WRAP_CONTENT, 320
- IP_WIDTH - INSETS, INSETS - 10);
edtIpAddress.setLayoutParams(p);
layout.addView(edtIpAddress);
cbxAccelerometer = new CheckBox(this);
cbxAccelerometer.setSelected(false);
p = new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.WRAP_CONTENT,
AbsoluteLayout.LayoutParams.WRAP_CONTENT, 320 - IP_WIDTH - INSETS, 3 * INSETS - 10);
cbxAccelerometer.setLayoutParams(p);
cbxAccelerometer.setOnCheckedChangeListener(this);
layout.addView(cbxAccelerometer);
setContentView(layout);
}
示例13: letakkanPanah
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
protected void letakkanPanah() {
float y = this.ukuranUiPx - (this.hue * this.ukuranUiPx / 360.f);
if (y == this.ukuranUiPx) {
y = 0.f;
}
AbsoluteLayout.LayoutParams layoutParams = (AbsoluteLayout.LayoutParams) this.panah
.getLayoutParams();
layoutParams.y = (int) (y + 4);
this.panah.setLayoutParams(layoutParams);
}
示例14: letakkanKeker
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
protected void letakkanKeker() {
float x = this.sat * this.ukuranUiPx;
float y = (1.f - this.val) * this.ukuranUiPx;
AbsoluteLayout.LayoutParams layoutParams = (AbsoluteLayout.LayoutParams) this.viewKeker
.getLayoutParams();
layoutParams.x = (int) (x + 3);
layoutParams.y = (int) (y + 3);
this.viewKeker.setLayoutParams(layoutParams);
}
示例15: ChatRoomView
import android.widget.AbsoluteLayout; //導入方法依賴的package包/類
public ChatRoomView(Context context, final ViewGroup container, Type type) {
this.mContainer = (AbsoluteLayout) container;
this.mContext = context;
this.type = type;
int width = ScreenUtils.getScreenWidth(mContext);
AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams(width, ViewGroup.LayoutParams
.MATCH_PARENT, 0, 0);
mainView = new LinearLayout(mContext);
mainView.setLayoutParams(new ViewGroup.LayoutParams(ScreenUtils.getScreenWidth(mContext),
ViewGroup.LayoutParams.MATCH_PARENT));
mainView.setOrientation(LinearLayout.VERTICAL);
mRecyclerView = new RecyclerView(mContext);
mRecyclerView.setId(android.R.id.list);
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext) {
@Override
public boolean canScrollVertically() {
return !isDragging;
}
});
mainView.addView(initToolbar());
mainView.addView(mRecyclerView);
mainView.setClickable(true);
mainView.setBackgroundColor(Color.parseColor("#" + AppSaveInfoUtils.INSTANCE.helperColorInfo()));
initSwipeBack();
mContainer.addView(swipeBackLayout, params);
swipeBackLayout.post(new Runnable() {
@Override
public void run() {
swipeBackLayout.mSlideOffset = 1;
Log.v("dispatchKeyEvent", " isShowing, mSlideOffset = " + swipeBackLayout.mSlideOffset);
}
});
swipeBackLayout.mSlideOffset = 1;
uuid = DeviceUtils.getIMELCode(context);
ApiManager.INSTANCE.sendRequestForUserStatistics("init", uuid, Build.MODEL);
}