List of usage examples for android.view Gravity TOP
int TOP
To view the source code for android.view Gravity TOP.
Click Source Link
From source file:com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper.java
private void onSizeChangedTraditionalRotation(int w, int h, int oldw, int oldh) { final VerticalSeekBar seekBar = getChildSeekBar(); if (seekBar != null) { final FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) seekBar.getLayoutParams(); lp.width = ViewGroup.LayoutParams.WRAP_CONTENT; lp.height = h;//from w ww . ja v a 2s .c o m seekBar.setLayoutParams(lp); seekBar.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); lp.gravity = Gravity.TOP | Gravity.LEFT; lp.leftMargin = (w - seekBar.getMeasuredWidth()) / 2; seekBar.setLayoutParams(lp); } super.onSizeChanged(w, h, oldw, oldh); }
From source file:biz.easymenu.easymenung.NoteDialog.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = li.inflate(R.layout.notedialog, container, false); WindowManager.LayoutParams WMLP = this.getDialog().getWindow().getAttributes(); WMLP.y = 100; //y position WMLP.gravity = Gravity.TOP; WMLP.windowAnimations = R.style.PauseDialogAnimation; this.getDialog().getWindow().setAttributes(WMLP); this.getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); etNote = (EditText) v.findViewById(R.id.txtNoteDlg); btnNoteOk = (Button) v.findViewById(R.id.btnNoteOK); btnNoteOk.setOnClickListener(new View.OnClickListener() { @Override/* ww w.j a va 2 s . c o m*/ public void onClick(View v) { itemFrag.setNote(etNote.getText().toString()); InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(etNote.getWindowToken(), 0); dismiss(); } }); btnNoteCancel = (Button) v.findViewById(R.id.btnNoteCancel); btnNoteCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(etNote.getWindowToken(), 0); dismiss(); } }); etNote.setText(note); return v; }
From source file:com.longle1.facedetection.TimedAsyncHttpResponseHandler.java
@Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { Log.e("RTT", String.format("%.1f", (System.nanoTime() - startTime) / 1e6) + " ms"); String msg = "RTT: " + String.format("%.1f", (System.nanoTime() - startTime) / 1e6) + " ms"; Toast mToast = Toast.makeText(mContext, msg, Toast.LENGTH_SHORT); mToast.setGravity(Gravity.TOP, 0, 0); TextView v = (TextView) mToast.getView().findViewById(android.R.id.message); v.setTextColor(Color.RED);//from w w w. ja va 2 s. c o m mToast.show(); }
From source file:com.example.android.support.transition.widget.ArcMotionUsage.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mRoot = findViewById(R.id.root);//from w w w .j av a 2 s .c om mTarget = findViewById(R.id.target); mTransition = new ChangeBounds(); mTransition.setPathMotion(new ArcMotion()); mTransition.setInterpolator(new FastOutSlowInInterpolator()); mTransition.setDuration(500); findViewById(R.id.move).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TransitionManager.beginDelayedTransition(mRoot, mTransition); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mTarget.getLayoutParams(); if ((lp.gravity & Gravity.START) == Gravity.START) { lp.gravity = Gravity.END | Gravity.BOTTOM; } else { lp.gravity = Gravity.START | Gravity.TOP; } mTarget.setLayoutParams(lp); } }); }
From source file:com.anl.wxb.jieqi.view.VerticalSeekBarWrapper.java
private void onSizeChangedTraditionalRotation(int w, int h, int oldw, int oldh) { final VerticalSeekBar seekBar = getChildSeekBar(); if (seekBar != null) { final LayoutParams lp = (LayoutParams) seekBar.getLayoutParams(); lp.width = ViewGroup.LayoutParams.WRAP_CONTENT; lp.height = h;/* w ww . ja v a2 s. c o m*/ seekBar.setLayoutParams(lp); seekBar.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); int seekBarWidth = seekBar.getMeasuredWidth(); seekBar.measure(MeasureSpec.makeMeasureSpec(w, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(h, MeasureSpec.EXACTLY)); lp.gravity = Gravity.TOP | Gravity.LEFT; lp.leftMargin = (w - seekBarWidth) / 2; seekBar.setLayoutParams(lp); } super.onSizeChanged(w, h, oldw, oldh); }
From source file:io.github.importre.android.chromeadb.ChromeAdbService.java
private void addMouseCursor() { if (mCursorImage == null) { mCursorImage = new ImageView(this); mCursorImage.setImageResource(R.drawable.cursor); }//from w ww.ja v a 2 s . c om if (mLayoutParam == null) { mLayoutParam = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, PixelFormat.TRANSLUCENT); mLayoutParam.gravity = Gravity.LEFT | Gravity.TOP; mLayoutParam.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; } if (mWindowManager == null) { mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE); mWindowManager.addView(mCursorImage, mLayoutParam); } }
From source file:com.music.android.widget.VerticalSeekBarWrapper.java
private void onSizeChangedTraditionalRotation(int w, int h, int oldw, int oldh) { final VerticalSeekBar seekBar = getChildSeekBar(); if (seekBar != null) { final FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) seekBar.getLayoutParams(); lp.width = ViewGroup.LayoutParams.WRAP_CONTENT; lp.height = h;/*from w ww .j a va2 s .co m*/ seekBar.setLayoutParams(lp); seekBar.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); int seekBarWidth = seekBar.getMeasuredWidth(); seekBar.measure(MeasureSpec.makeMeasureSpec(w, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(h, MeasureSpec.EXACTLY)); lp.gravity = Gravity.TOP | Gravity.LEFT; lp.leftMargin = (w - seekBarWidth) / 2; seekBar.setLayoutParams(lp); } super.onSizeChanged(w, h, oldw, oldh); }
From source file:com.king.android.common.widget.badge.BGADragBadgeView.java
private void initLayoutParams() { mLayoutParams = new WindowManager.LayoutParams(); mLayoutParams.gravity = Gravity.LEFT + Gravity.TOP; mLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; mLayoutParams.format = PixelFormat.TRANSLUCENT; mLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; mLayoutParams.width = mWindowManager.getDefaultDisplay().getWidth(); mLayoutParams.height = mWindowManager.getDefaultDisplay().getHeight(); }
From source file:com.pyamsoft.zaptorch.service.OriginalCamera.java
OriginalCamera(final @NonNull Context context, final @NonNull VolumeServiceInteractor interactor) { super(context, interactor); Timber.d("OLD CAMERA API"); opened = false;/*from w w w . j a v a 2 s . co m*/ surfaceView = new SurfaceView(getAppContext()); windowManager = (WindowManager) getAppContext().getSystemService(Context.WINDOW_SERVICE); params = new WindowManager.LayoutParams(); params.width = 1; params.height = 1; params.gravity = Gravity.TOP | Gravity.START; params.format = PixelFormat.TRANSLUCENT; params.type = WindowManager.LayoutParams.TYPE_TOAST; params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; }
From source file:com.lib.media.widget.seekbar.VerticalSeekBarWrapper.java
private void onSizeChangedTraditionalRotation(int w, int h, int oldw, int oldh) { final VerticalSeekBar seekBar = getChildSeekBar(); if (seekBar != null) { final int hPadding = getPaddingLeft() + getPaddingRight(); final int vPadding = getPaddingTop() + getPaddingBottom(); final LayoutParams lp = (LayoutParams) seekBar.getLayoutParams(); lp.width = ViewGroup.LayoutParams.WRAP_CONTENT; lp.height = Math.max(0, h - vPadding); seekBar.setLayoutParams(lp);/* w w w . j av a2 s . c om*/ seekBar.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED); final int seekBarMeasuredWidth = seekBar.getMeasuredWidth(); seekBar.measure(MeasureSpec.makeMeasureSpec(Math.max(0, w - hPadding), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(Math.max(0, h - vPadding), MeasureSpec.EXACTLY)); lp.gravity = Gravity.TOP | Gravity.LEFT; lp.leftMargin = (Math.max(0, w - hPadding) - seekBarMeasuredWidth) / 2; seekBar.setLayoutParams(lp); } super.onSizeChanged(w, h, oldw, oldh); }