List of usage examples for android.widget RelativeLayout ABOVE
int ABOVE
To view the source code for android.widget RelativeLayout ABOVE.
Click Source Link
From source file:Main.java
public static void applyAttributes(JSONObject jsonObject, RelativeLayout.LayoutParams layoutParams) throws JSONException { applyRelativeLayoutRuleIfExists(jsonObject, layoutParams, TO_LEFT_OF, RelativeLayout.LEFT_OF); applyRelativeLayoutRuleIfExists(jsonObject, layoutParams, TO_RIGHT_OF, RelativeLayout.RIGHT_OF); applyRelativeLayoutRuleIfExists(jsonObject, layoutParams, BELOW, RelativeLayout.BELOW); applyRelativeLayoutRuleIfExists(jsonObject, layoutParams, ABOVE, RelativeLayout.ABOVE); applyRelativeLayoutRuleIfExists(jsonObject, layoutParams, ALIGN_LEFT, RelativeLayout.ALIGN_LEFT); applyRelativeLayoutRuleIfExists(jsonObject, layoutParams, ALIGN_RIGHT, RelativeLayout.ALIGN_RIGHT); applyRelativeLayoutRuleIfExists(jsonObject, layoutParams, ALIGN_TOP, RelativeLayout.ALIGN_TOP); applyRelativeLayoutBooleanIfExists(jsonObject, layoutParams, ALIGN_PARENT_TOP, RelativeLayout.ALIGN_PARENT_TOP); applyRelativeLayoutBooleanIfExists(jsonObject, layoutParams, ALIGN_PARENT_BOTTOM, RelativeLayout.ALIGN_PARENT_BOTTOM); applyRelativeLayoutBooleanIfExists(jsonObject, layoutParams, ALIGN_PARENT_RIGHT, RelativeLayout.ALIGN_PARENT_RIGHT); applyRelativeLayoutBooleanIfExists(jsonObject, layoutParams, ALIGN_PARENT_LEFT, RelativeLayout.ALIGN_PARENT_LEFT); applyRelativeLayoutBooleanIfExists(jsonObject, layoutParams, ALIGN_BASELINE, RelativeLayout.ALIGN_BASELINE); applyRelativeLayoutBooleanIfExists(jsonObject, layoutParams, ALIGN_PARENT_TOP, RelativeLayout.ALIGN_PARENT_TOP); applyRelativeLayoutBooleanIfExists(jsonObject, layoutParams, CENTER_HORIZONTAL, RelativeLayout.CENTER_HORIZONTAL); applyRelativeLayoutBooleanIfExists(jsonObject, layoutParams, CENTER_IN_PARENT, RelativeLayout.CENTER_IN_PARENT); applyRelativeLayoutBooleanIfExists(jsonObject, layoutParams, CENTER_VERTICAL, RelativeLayout.CENTER_VERTICAL); }
From source file:com.ab.activity.AbActivity.java
/** * ??./* w w w. jav a 2s . c o m*/ * * @param savedInstanceState the saved instance state * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); mInflater = LayoutInflater.from(this); //? mAbTitleBar = new AbTitleBar(this); // ab_base = new RelativeLayout(this); ab_base.setBackgroundColor(Color.rgb(255, 255, 255)); // contentLayout = new RelativeLayout(this); contentLayout.setPadding(0, 0, 0, 0); //? mAbBottomBar = new AbBottomBar(this); //View ab_base.addView(mAbTitleBar, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); mAbTitleBar.setVisibility(View.GONE); RelativeLayout.LayoutParams layoutParamsBottomBar = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsBottomBar.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); ab_base.addView(mAbBottomBar, layoutParamsBottomBar); RelativeLayout.LayoutParams layoutParamsContent = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsContent.addRule(RelativeLayout.BELOW, mAbTitleBar.getId()); layoutParamsContent.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId()); ab_base.addView(contentLayout, layoutParamsContent); //Application? abApplication = getApplication(); //ContentView setContentView(ab_base, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); }
From source file:com.bangqu.eshow.activity.ESActivity.java
/** * ??.//from w w w . j a va 2 s . com * * @param savedInstanceState the saved instance state * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); mInflater = LayoutInflater.from(this); //? mAbTitleBar = new ESTitleBar(this); // ab_base = new RelativeLayout(this); ab_base.setBackgroundColor(Color.rgb(255, 255, 255)); // contentLayout = new RelativeLayout(this); contentLayout.setPadding(0, 0, 0, 0); //? mAbBottomBar = new ESBottomBar(this); //View ab_base.addView(mAbTitleBar, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); mAbTitleBar.setVisibility(View.GONE); RelativeLayout.LayoutParams layoutParamsBottomBar = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsBottomBar.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); ab_base.addView(mAbBottomBar, layoutParamsBottomBar); RelativeLayout.LayoutParams layoutParamsContent = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsContent.addRule(RelativeLayout.BELOW, mAbTitleBar.getId()); layoutParamsContent.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId()); ab_base.addView(contentLayout, layoutParamsContent); //Application? abApplication = getApplication(); //ContentView setContentView(ab_base, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); ESActivityManager.getInstance().addActivity(this); }
From source file:cn.org.eshow.framwork.activity.AbActivity.java
/** * ??./* w ww . j a v a2 s . c om*/ * * @param savedInstanceState the saved instance state * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); mInflater = LayoutInflater.from(this); //? mAbTitleBar = new AbTitleBar(this); // ab_base = new RelativeLayout(this); ab_base.setBackgroundColor(Color.rgb(255, 255, 255)); // contentLayout = new RelativeLayout(this); contentLayout.setPadding(0, 0, 0, 0); //? mAbBottomBar = new AbBottomBar(this); //View ab_base.addView(mAbTitleBar, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); mAbTitleBar.setVisibility(View.GONE); RelativeLayout.LayoutParams layoutParamsBottomBar = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsBottomBar.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); ab_base.addView(mAbBottomBar, layoutParamsBottomBar); RelativeLayout.LayoutParams layoutParamsContent = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsContent.addRule(RelativeLayout.BELOW, mAbTitleBar.getId()); layoutParamsContent.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId()); ab_base.addView(contentLayout, layoutParamsContent); //Application? abApplication = getApplication(); //ContentView setContentView(ab_base, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); AbActivityManager.getInstance().addActivity(this); }
From source file:de.uni_weimar.m18.anatomiederstadt.element.SliderFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_slider, container, false); SeekBar sb = (SeekBar) view.findViewById(R.id.seekBar); // scale mMin and mMax mMin = (int) (mMin / mGranularity); mMax = (int) (mMax / mGranularity); sb.setMax(mMax - mMin);/* ww w . ja v a 2s.c o m*/ sb.setProgress((mMax - mMin) / 2); final RelativeLayout balloon = (RelativeLayout) view.findViewById(R.id.indicatorBalloon); final Space space = (Space) view.findViewById(R.id.balloonSpace); final Context context = getActivity(); final TextView balloonText = (TextView) view.findViewById(R.id.indicatorTextView); final float[] value = { 0.0f }; sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); p.addRule(RelativeLayout.ABOVE, seekBar.getId()); Rect thumbRect = seekBar.getThumb().getBounds(); value[0] = mMin + progress * mGranularity; String valueString = new DecimalFormat("#.##").format(value[0]); balloonText.setText(String.valueOf(valueString) + " " + mSuffix); int balloonWidth = balloonText.getWidth(); p.setMargins(thumbRect.centerX() - balloonWidth / 2, 0, 0, 0); balloon.setLayoutParams(p); balloon.setVisibility(View.VISIBLE); final Animation animFadeOut = AnimationUtils.loadAnimation(context, R.anim.fade_out); balloon.startAnimation(animFadeOut); animFadeOut.setStartOffset(1000); animFadeOut.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { balloon.setVisibility(View.INVISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { LevelStateManager stateManager = ((AnatomieDerStadtApplication) getActivity() .getApplicationContext()).getStateManager(getActivity()); stateManager.saveFloat(mVar, value[0]); } }); return view; }
From source file:de.gebatzens.ggvertretungsplan.fragment.RemoteDataFragment.java
public void createButtonWithText(Activity activity, ViewGroup l, String text, String button, View.OnClickListener onclick) { RelativeLayout r = new RelativeLayout(activity); r.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); TextView tv = new TextView(activity); RelativeLayout.LayoutParams tvparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); tvparams.addRule(RelativeLayout.ABOVE, R.id.reload_button); tvparams.addRule(RelativeLayout.CENTER_HORIZONTAL); tv.setLayoutParams(tvparams);/*from w ww . ja va 2 s . com*/ tv.setText(text); tv.setTextSize(23); tv.setPadding(0, 0, 0, toPixels(15)); tv.setGravity(Gravity.CENTER_HORIZONTAL); r.addView(tv); Button b = new Button(activity); RelativeLayout.LayoutParams bparams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); bparams.addRule(RelativeLayout.CENTER_VERTICAL); bparams.addRule(RelativeLayout.CENTER_HORIZONTAL); b.setLayoutParams(bparams); b.setId(R.id.reload_button); b.setText(button); b.setTextSize(23); b.setAllCaps(false); b.setTypeface(null, Typeface.NORMAL); b.setOnClickListener(onclick); r.addView(b); l.addView(r); }
From source file:cn.org.eshow.framwork.activity.AbActivity.java
/** * ?????./* w w w. ja va 2s. co m*/ * * @param overlay the new title bar overlay */ public void setTitleBarOverlay(boolean overlay) { ab_base.removeAllViews(); if (overlay) { RelativeLayout.LayoutParams layoutParamsFW1 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW1.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId()); ab_base.addView(contentLayout, layoutParamsFW1); RelativeLayout.LayoutParams layoutParamsFW2 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW2.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); ab_base.addView(mAbTitleBar, layoutParamsFW2); RelativeLayout.LayoutParams layoutParamsFW3 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW3.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); ab_base.addView(mAbBottomBar, layoutParamsFW3); } else { ab_base.addView(mAbTitleBar, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams layoutParamsFW2 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); ab_base.addView(mAbBottomBar, layoutParamsFW2); RelativeLayout.LayoutParams layoutParamsFW1 = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParamsFW1.addRule(RelativeLayout.BELOW, mAbTitleBar.getId()); layoutParamsFW1.addRule(RelativeLayout.ABOVE, mAbBottomBar.getId()); ab_base.addView(contentLayout, layoutParamsFW1); } }
From source file:edu.rowan.app.carousel.CarouselFeature.java
private void setupView() { imageView.setId(1);// w w w . j av a2 s . c om RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); imageParams.addRule(RelativeLayout.CENTER_HORIZONTAL); imageView.setLayoutParams(imageParams); // imageView.setAdjustViewBounds(true); Resources r = context.getResources(); int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, r.getDisplayMetrics()); TextView descriptionView = new TextView(context); descriptionView.setId(2); descriptionView.setPadding(padding, 0, padding, padding); descriptionView.setText(description); descriptionView.setBackgroundColor(Color.argb(220, 63, 26, 10)); descriptionView.setTextColor(Color.WHITE); RelativeLayout.LayoutParams descParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); descParams.addRule(RelativeLayout.ALIGN_BOTTOM, imageView.getId()); carouselView.addView(descriptionView, descParams); TextView titleView = new TextView(context); titleView.setText(title); titleView.setPadding(padding, 0, padding, 0); RelativeLayout.LayoutParams titleParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); titleParams.addRule(RelativeLayout.ABOVE, descriptionView.getId()); titleView.setLayoutParams(titleParams); titleView.setTextColor(Color.WHITE); titleView.setShadowLayer(2, 3, 3, Color.argb(230, 0, 0, 0)); titleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); carouselView.addView(titleView); }
From source file:com.dvdprime.mobile.android.ui.DocumentViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_Sherlock_Light); requestWindowFeature(Window.FEATURE_PROGRESS); super.onCreate(savedInstanceState); // Initialize WebView mWebView = new DpWebView(this); mWebView.setId(mWebView.hashCode()); mWebView.setOnCreateContextMenuListener(this); // Initialize Ad. mAdManager = new DpAdManager(); mAdManager.onCreate(this); mLayout = new RelativeLayout(this); mAdView = new DpAdViewCore(this); mAdView.setId(mAdView.hashCode());/*from w ww . j a v a 2 s .c o m*/ RelativeLayout.LayoutParams layoutParams1 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); layoutParams1.addRule(RelativeLayout.ABOVE, mAdView.getId()); mLayout.addView(mWebView, layoutParams1); RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); mLayout.addView(mAdView, layoutParams2); mAdManager.bindCoreView(mAdView); setContentView(mLayout); // Initialize pull to refresh mPullToRefreshAttacher = PullToRefreshAttacher.get(this); mPullToRefreshAttacher.addRefreshableView(mWebView, this); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { mLayout.findViewById(mAdView.getId()).setVisibility(View.GONE); } this.overridePendingTransition(R.anim.start_enter, R.anim.start_exit); this.mActivity = this; Bundle bundle = getIntent().getExtras(); if (bundle != null) { try { index = bundle.getInt("index", 0); Document doc = (Document) DpApp.getDocumentList().get(this.index); getSupportActionBar().setTitle(doc.getUserName()); getSupportActionBar().setSubtitle(doc.getTitle()); mUrl = Config.getAbsoluteUrl("/bbs" + doc.getUrl()); } catch (Exception e) { } } Uri uri = getIntent().getData(); if (uri != null) { this.mUrl = uri.toString(); if (getIntent().getExtras().getString("targetKey") != null) { mTargetKey = getIntent().getExtras().getString("targetKey"); } } if (StringUtil.isBlank(this.mUrl)) { finish(); } getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayUseLogoEnabled(true); // Initialize EventBus EventBusProvider.getInstance().register(this, String.class, new Class[] { Refresh.class }); // Request Document View StringRequest req = new StringRequest(0, this.mUrl, createReqSuccessListener(), createReqErrorListener()); req.setTag(this.TAG); DpApp.getRequestQueue().add(req); // Initialize Google Analytics EasyTracker.getInstance().setContext(this.mActivity); EasyTracker.getTracker().sendView("DocView"); LogUtil.LOGD("Tracker", "DocView"); }
From source file:timer.com.maydaysdk.MayDayMessageChatFragment.java
@Override public void onClick(View view) { if (view.getId() == R.id.imageButton_send) { // Tap on chat send button send message data to list fragment. HashMap<String, String> sendParams = new HashMap<>(); sendParams.put(MayDayConstant.USERNAME, (String) mMessageParams.get(MayDayConstant.USERNAME)); if (mDevice.sendMessage(mEditTextChatMessage.getText().toString(), sendParams)) { // also output the message in the wall mListFragment.addLocalMessage(mEditTextChatMessage.getText().toString()); mEditTextChatMessage.setText(""); } else {/* www. j ava 2s . c o m*/ showAlert(); } } else if (view.getId() == R.id.imageButton_chat_resize) { // Tap on chat resize to maximise and minimise. int height = getScreenResolution(); if (!isChatFullScreen) { isChatFullScreen = true; mImageButtonChatResize.setImageResource(R.drawable.chat_minimize); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.ABOVE, R.id.linearLayout_chat_controls); mLinearLayoutMessage.setLayoutParams(layoutParams); mLinearLayoutMessage.setPadding(0, 0, 0, 0); } else { mImageButtonChatResize.setImageResource(R.drawable.chat_maximize); isChatFullScreen = false; RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, height); layoutParams.addRule(RelativeLayout.ABOVE, R.id.linearLayout_chat_controls); mLinearLayoutMessage.setLayoutParams(layoutParams); mLinearLayoutMessage.setPadding(30, 0, 30, 0); } } else if (view.getId() == R.id.imageButton_chat_close) { //chat message close pass encrypt key. HashMap<String, String> sendParams = new HashMap<>(); sendParams.put(MayDayConstant.USERNAME, (String) mMessageParams.get(MayDayConstant.USERNAME)); mDevice.sendMessage(MayDayConstant.CHAT_CLOSE_ENCRYPT_KEY, sendParams); hideSoftKeyboard(getActivity()); mCallBackInterface.onMayDayClose(); } }