List of usage examples for android.widget RelativeLayout ALIGN_PARENT_TOP
int ALIGN_PARENT_TOP
To view the source code for android.widget RelativeLayout ALIGN_PARENT_TOP.
Click Source Link
From source file:com.dragon4.owo.ar_trace.ARCore.MixView.java
public void initNaverMap() { naverFragment = new FragmentMapview(); naverFragment.setArguments(new Bundle()); final Button expandView = (Button) mainArView.findViewById(R.id.ar_mixview_naverview_expand); expandView.setOnClickListener(new View.OnClickListener() { boolean isFull = false; @Override//from w w w. ja va2s . c o m public void onClick(View view) { RelativeLayout navermapWrapper = (RelativeLayout) mainArView .findViewById(R.id.ar_mixview_naverview_wrapper); if (isFull) { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, naver_map_width, Resources.getSystem().getDisplayMetrics()), (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, naver_map_height, Resources.getSystem().getDisplayMetrics())); int tenMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, Resources.getSystem().getDisplayMetrics()); params.setMargins(0, tenMargin, tenMargin, 0); params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); params.addRule(RelativeLayout.ALIGN_PARENT_TOP); navermapWrapper.setLayoutParams(params); expandView.setBackgroundResource(R.drawable.ic_minimap_zoom_in); isFull = false; } else { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); params.setMargins(0, 0, 0, 0); navermapWrapper.setLayoutParams(params); expandView.setBackgroundResource(R.drawable.ic_minimap_zoom_out); isFull = true; } } }); try { FragmentTransaction fragmentTransaction = ((FragmentActivity) context).getSupportFragmentManager() .beginTransaction(); fragmentTransaction.add(R.id.ar_mixview_naverview, naverFragment); fragmentTransaction.commit(); } catch (Exception e) { e.printStackTrace(); Log.i(TAG, "Only FragmentActivity can use naver maps"); } }
From source file:com.codename1.impl.android.AndroidImplementation.java
/** * init view. a lot of back and forth between this thread and the UI thread. *///ww w. j a va 2 s.c o m private void initSurface() { if (getActivity() != null && myView == null) { relativeLayout = new RelativeLayout(getActivity()); relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT)); relativeLayout.setFocusable(false); getActivity().getWindow().setBackgroundDrawable(null); if (asyncView) { if (android.os.Build.VERSION.SDK_INT < 14) { myView = new AndroidSurfaceView(getActivity(), AndroidImplementation.this); } else { int hardwareAcceleration = 16777216; getActivity().getWindow().setFlags(hardwareAcceleration, hardwareAcceleration); myView = new AndroidAsyncView(getActivity(), AndroidImplementation.this); } } else { int hardwareAcceleration = 16777216; getActivity().getWindow().setFlags(hardwareAcceleration, hardwareAcceleration); superPeerMode = true; myView = new AndroidAsyncView(getActivity(), AndroidImplementation.this); } myView.getAndroidView().setVisibility(View.VISIBLE); relativeLayout.addView(myView.getAndroidView()); myView.getAndroidView().setVisibility(View.VISIBLE); int id = getActivity().getResources().getIdentifier("main", "layout", getActivity().getApplicationInfo().packageName); RelativeLayout root = (RelativeLayout) LayoutInflater.from(getActivity()).inflate(id, null); if (viewAbove != null) { RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.ALIGN_PARENT_TOP); lp.addRule(RelativeLayout.CENTER_HORIZONTAL); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); lp2.setMargins(0, 0, aboveSpacing, 0); relativeLayout.setLayoutParams(lp2); root.addView(viewAbove, lp); } root.addView(relativeLayout); if (viewBelow != null) { RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); lp.addRule(RelativeLayout.CENTER_HORIZONTAL); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); lp2.setMargins(0, 0, 0, belowSpacing); relativeLayout.setLayoutParams(lp2); root.addView(viewBelow, lp); } getActivity().setContentView(root); if (!myView.getAndroidView().hasFocus()) { myView.getAndroidView().requestFocus(); } } }
From source file:com.aimfire.demo.CamcorderActivity.java
private void adjustUIControls(int rotation) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mShutterLayout.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mShutterLayout.setLayoutParams(layoutParams); mShutterLayout.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mPvButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ABOVE, 0); layoutParams.addRule(RelativeLayout.BELOW, R.id.shutter_layout); mPvButton.setLayoutParams(layoutParams); mPvButton.setRotation(rotation);//from w w w. j a v a 2 s. c o m /* layoutParams = (RelativeLayout.LayoutParams)mFbButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ABOVE, R.id.shutter_layout); layoutParams.addRule(RelativeLayout.BELOW, 0); mFbButton.setLayoutParams(layoutParams); mFbButton.setRotation(rotation); */ layoutParams = (RelativeLayout.LayoutParams) mExitButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); mExitButton.setLayoutParams(layoutParams); mExitButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mView3DButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mView3DButton.setLayoutParams(layoutParams); mView3DButton.setRotation(rotation); View view3DPb = findViewById(R.id.view3D_progress_bar); layoutParams = (RelativeLayout.LayoutParams) view3DPb.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); view3DPb.setLayoutParams(layoutParams); view3DPb.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mScanProgView.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.LEFT_OF, 0); layoutParams.addRule(RelativeLayout.RIGHT_OF, 0); mScanProgView.setLayoutParams(layoutParams); mScanProgView.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mScanModeButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.LEFT_OF, 0); layoutParams.addRule(RelativeLayout.RIGHT_OF, 0); mScanModeButton.setLayoutParams(layoutParams); mScanModeButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mLevelButton.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); mLevelButton.setLayoutParams(layoutParams); mLevelButton.setRotation(rotation); layoutParams = (RelativeLayout.LayoutParams) mTimeCounter.getLayoutParams(); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.LEFT_OF, R.id.mode_button); layoutParams.addRule(RelativeLayout.RIGHT_OF, 0); layoutParams.addRule(RelativeLayout.ABOVE, 0); layoutParams.addRule(RelativeLayout.BELOW, 0); mTimeCounter.setLayoutParams(layoutParams); if ((rotation == 0) || (rotation == 180)) { mTimeCounter.setTranslationY(0); } else { mTimeCounter.setTranslationY(mTimeCounter.getWidth() / 2); } mTimeCounter.setRotation(rotation); CustomToast.setRotation(rotation); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
public void promptVNCAllowExternal(final Activity activity) { final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Enable VNC server"); TextView textView = new TextView(activity); textView.setVisibility(View.VISIBLE); textView.setId(201012010);//from w ww .j a v a2 s .co m textView.setText("VNC Server: " + this.getLocalIpAddress() + ":" + "5901\n" + "Warning: VNC is not secure make sure you're on a private network!\n"); EditText passwdView = new EditText(activity); passwdView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); passwdView.setHint("Password"); passwdView.setEnabled(true); passwdView.setVisibility(View.VISIBLE); passwdView.setId(11111); passwdView.setSingleLine(); RelativeLayout mLayout = new RelativeLayout(this); mLayout.setId(12222); RelativeLayout.LayoutParams textViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); textViewParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, mLayout.getId()); mLayout.addView(textView, textViewParams); RelativeLayout.LayoutParams passwordViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); passwordViewParams.addRule(RelativeLayout.BELOW, textView.getId()); // passwordViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, // mLayout.getId()); mLayout.addView(passwdView, passwordViewParams); alertDialog.setView(mLayout); final Handler handler = this.handler; alertDialog.setButton("Set", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // UIUtils.log("Searching..."); EditText a = (EditText) alertDialog.findViewById(11111); if (a.getText().toString().trim().equals("")) { Toast.makeText(getApplicationContext(), "Password cannot be empty!", Toast.LENGTH_SHORT).show(); vnc_passwd = null; vnc_allow_external = 0; mVNCAllowExternal.setChecked(false); // LimboSettingsManager.setVNCAllowExternal(activity, false); return; } else { sendHandlerMessage(handler, Const.VNC_PASSWORD, "vnc_passwd", "passwd"); vnc_passwd = a.getText().toString(); vnc_allow_external = 1; // LimboSettingsManager.setVNCAllowExternal(activity, true); } } }); alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { vnc_passwd = null; vnc_allow_external = 0; mVNCAllowExternal.setChecked(false); // LimboSettingsManager.setVNCAllowExternal(activity, false); return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mVNCAllowExternal.setChecked(false); // LimboSettingsManager.setVNCAllowExternal(activity, false); vnc_passwd = null; vnc_allow_external = 0; } }); alertDialog.show(); }
From source file:com.bookkos.bircle.CaptureActivity.java
private void setScanUnregisterBookView() { int registSelectShelfRelativeLayout_width = displayWidth; int registSelectShelfRelativeLayout_height = displayHeight / 3; int registSelectShelfRelativeLayout_x = 0; int registSelectShelfRelativeLayout_y = displayHeight; registSelectShelfRelativeLayout.setTranslationX(registSelectShelfRelativeLayout_x); registSelectShelfRelativeLayout.setTranslationY(registSelectShelfRelativeLayout_y); registSelectShelfRelativeLayout.setLayoutParams(new FrameLayout.LayoutParams( registSelectShelfRelativeLayout_width, registSelectShelfRelativeLayout_height)); //registSelectShelfRelativeLayout.setVisibility(View.GONE); int textViewLinearLayout_width = displayWidth; int textViewLinearLayout_height = registSelectShelfRelativeLayout_height / 4; textViewLinearLayout.setLayoutParams( new RelativeLayout.LayoutParams(textViewLinearLayout_width, textViewLinearLayout_height)); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) textViewLinearLayout.getLayoutParams(); // params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params1.addRule(RelativeLayout.ALIGN_PARENT_TOP); textViewLinearLayout.setLayoutParams(params1); String tempText = "<font color=#3498db>?????!</font><br />?????????QR???, ?????\"\"????"; tempTextView.setText(Html.fromHtml(tempText)); tempTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f); int buttonLinearLayout_width = displayWidth; int buttonLinearLayout_height = registSelectShelfRelativeLayout_height / 4; int buttonLinearLayout_x = 0; int buttonLinearLayout_y = displayHeight; // buttonLinearLayout.setTranslationX(buttonLinearLayout_x); // buttonLinearLayout.setTranslationY(buttonLinearLayout_y); buttonLinearLayout.setLayoutParams(/*from w w w. j a v a 2 s . c om*/ new RelativeLayout.LayoutParams(buttonLinearLayout_width, buttonLinearLayout_height)); RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) buttonLinearLayout.getLayoutParams(); params2.addRule(RelativeLayout.BELOW, R.id.text_view_linear_layout); buttonLinearLayout.setLayoutParams(params2); int listViewLinearLayout_width = displayWidth; int listViewLinearLayout_height = registSelectShelfRelativeLayout_height / 2; int listViewLinearLayout_x = 0; int listViewLinearLayout_y = displayHeight; // listViewLinearLayout.setTranslationX(listViewLinearLayout_x); // listViewLinearLayout.setTranslationY(listViewLinearLayout_y); listViewLinearLayout.setLayoutParams( new RelativeLayout.LayoutParams(listViewLinearLayout_width, listViewLinearLayout_height)); RelativeLayout.LayoutParams params3 = (RelativeLayout.LayoutParams) listViewLinearLayout.getLayoutParams(); params3.addRule(RelativeLayout.BELOW, R.id.button_linear_layout); listViewLinearLayout.setLayoutParams(params3); // listViewLinearLayout.setVisibility(View.GONE); int decisionButton_width = displayWidth / 5 * 2; // int decisionButton_height = displayHeight / 10; int decisionButton_height = registSelectShelfRelativeLayout_height / 4; int decisionButton_x = ((displayWidth / 2) - decisionButton_width) / 2; int decisionButton_y = displayHeight - (titleBarHeight * 4); decisionButton.setTranslationX(decisionButton_x); // decisionButton.setTranslationY(decisionButton_y); decisionButton.setLayoutParams(new LinearLayout.LayoutParams(decisionButton_width, decisionButton_height)); decisionButton.setBackgroundColor(Color.argb(255, 230, 126, 34)); decisionButton.setTextColor(Color.WHITE); decisionButton.setText(""); decisionButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { doDecideClick(registSelectShelfIsbn, registSelectShelfId, registSelectShelfName); registButton.setEnabled(true); borrowReturnButton.setEnabled(true); } }); int cancelButton_width = displayWidth / 5 * 2; // int cancelButton_height = displayHeight / 10; int cancelButton_height = registSelectShelfRelativeLayout_height / 4; int cancelButton_x = ((displayWidth / 2) + decisionButton_x) - decisionButton_width; int cancelButton_y = displayHeight - (titleBarHeight * 4); cancelButton.setTranslationX(cancelButton_x); // cancelButton.setTranslationY(cancelButton_y); cancelButton.setLayoutParams(new LinearLayout.LayoutParams(cancelButton_width, cancelButton_height)); cancelButton.setBackgroundColor(Color.argb(255, 127, 140, 141)); cancelButton.setText(""); cancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { resetRegistSelectShelfData(); animateTranslationY(registSelectShelfRelativeLayout, displayHeight - displayHeight / 3 - titleBarHeight, displayHeight); registFlag = 0; registButton.setEnabled(true); borrowReturnButton.setEnabled(true); } }); }
From source file:com.bookkos.bircle.CaptureActivity.java
private void setBookRegistView() { int bookRegistRelativeLayout_width = displayWidth; int bookRegistRelativeLayout_height = displayHeight / 4; int bookRegistRelativeLayout_x = 0; int bookRegistRelativeLayout_y = displayHeight; bookRegistRelativeLayout.setTranslationX(bookRegistRelativeLayout_x); bookRegistRelativeLayout.setTranslationY(bookRegistRelativeLayout_y); bookRegistRelativeLayout.setLayoutParams( new FrameLayout.LayoutParams(bookRegistRelativeLayout_width, bookRegistRelativeLayout_height)); int bookRegistLinearLayout_width = displayWidth; int bookRegistLinearLayout_height = bookRegistRelativeLayout_height / 3; bookRegistLinearLayout.setLayoutParams( new RelativeLayout.LayoutParams(bookRegistLinearLayout_width, bookRegistLinearLayout_height)); RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) bookRegistLinearLayout .getLayoutParams();// w ww. j ava2 s . c om params1.addRule(RelativeLayout.ALIGN_PARENT_TOP); bookRegistLinearLayout.setLayoutParams(params1); int bookRegistListViewLinearLayout_width = displayWidth; int bookRegistListViewLinearLayout_height = bookRegistRelativeLayout_height * 2 / 3; bookRegistListViewLinearLayout.setLayoutParams(new RelativeLayout.LayoutParams( bookRegistListViewLinearLayout_width, bookRegistListViewLinearLayout_height)); RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) bookRegistListViewLinearLayout .getLayoutParams(); params2.addRule(RelativeLayout.BELOW, R.id.book_regist_linear_layout); bookRegistListViewLinearLayout.setLayoutParams(params2); int bookRegistListView_width = bookRegistListViewLinearLayout_width; int bookRegistListView_height = bookRegistListViewLinearLayout_height; bookRegistListView.setLayoutParams( new LinearLayout.LayoutParams(bookRegistListView_width, bookRegistListView_height)); bookRegistListView.setAdapter(bookListViewAdapter); int bookRegistTextView_width = displayWidth * 4 / 5; int bookRegistTextView_height = bookRegistLinearLayout_height; int bookRegistTextView_x = 0; int bookRegistTextView_y = displayHeight; bookRegistTextView.setLayoutParams( new LinearLayout.LayoutParams(bookRegistTextView_width, bookRegistTextView_height, Gravity.LEFT)); bookRegistTextView.setText("??"); bookRegistTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f); int bookRegistCancelButton_width = displayWidth / 5; int bookRegistCancelButton_height = bookRegistLinearLayout_height; int bookRegistCancelButton_x = 0; int bookRegistCancelButton_y = displayHeight; bookRegistCancelButton.setLayoutParams(new LinearLayout.LayoutParams(bookRegistCancelButton_width, bookRegistCancelButton_height, Gravity.RIGHT)); bookRegistCancelButton.setText(""); bookRegistCancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f); bookRegistCancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { animateTranslationY(bookRegistRelativeLayout, displayHeight - displayHeight / 4 - titleBarHeight, displayHeight); arrayList.clear(); bookListViewAdapter.clear(); registButton.setEnabled(true); borrowReturnButton.setEnabled(true); registButton.setTextColor(Color.WHITE); } }); }