List of usage examples for android.widget RelativeLayout BELOW
int BELOW
To view the source code for android.widget RelativeLayout BELOW.
Click Source Link
From source file:fr.cph.stock.android.activity.AccountActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.v(TAG, "Account Activity onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.account_activity); Bundle b = getIntent().getExtras();//from w w w . j a v a 2s.c om portfolio = b.getParcelable("portfolio"); errorView = (TextView) findViewById(R.id.errorMessage); totalValueView = (TextView) findViewById(R.id.totalValue); totalGainView = (TextView) findViewById(R.id.totalGain); totalPlusMinusValueView = (TextView) findViewById(R.id.totalPlusMinusValue); lastUpateView = (TextView) findViewById(R.id.lastUpdate); liquidityView = (TextView) findViewById(R.id.liquidity); yieldYearView = (TextView) findViewById(R.id.yieldYear); shareValueView = (TextView) findViewById(R.id.shareValue); gainView = (TextView) findViewById(R.id.gain2); perfView = (TextView) findViewById(R.id.perf); yieldView = (TextView) findViewById(R.id.yieldPerf); taxesView = (TextView) findViewById(R.id.taxes); RelativeLayout accLayout = (RelativeLayout) findViewById(R.id.accountsLayout); TextView recent = new TextView(getApplicationContext()); textViews = new ArrayList<TextView>(); int id = 1; int nameID = 100; int viewId1 = 500; int currencyId = 1000; for (int i = 0; i < portfolio.getAccounts().size(); i++) { Account account = portfolio.getAccounts().get(i); TextView currentAccountNameTextView = new TextView(getApplicationContext()); currentAccountNameTextView.setText(account.getName()); currentAccountNameTextView.setTextColor(Color.GRAY); currentAccountNameTextView.setId(nameID); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) LayoutParams.WRAP_CONTENT, (int) LayoutParams.WRAP_CONTENT); if (i != 0) { params.addRule(RelativeLayout.BELOW, recent.getId()); } params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); currentAccountNameTextView.setLayoutParams(params); accLayout.addView(currentAccountNameTextView, params); textViews.add(currentAccountNameTextView); View viewPoint1 = new View(getApplicationContext()); viewPoint1.setId(viewId1); viewPoint1.setBackgroundColor(getResources().getColor(R.color.grey_light)); params = new RelativeLayout.LayoutParams((int) LayoutParams.MATCH_PARENT, 2); params.addRule(RelativeLayout.RIGHT_OF, nameID); params.addRule(RelativeLayout.LEFT_OF, currencyId); params.setMargins(0, Util.convertDpToPxl(15, getApplicationContext()), 0, 0); if (i != 0) { params.addRule(RelativeLayout.BELOW, recent.getId()); } viewPoint1.setLayoutParams(params); accLayout.addView(viewPoint1, params); TextView currentCurrencyTextView = new TextView(getApplicationContext()); currentCurrencyTextView.setText(account.getCurrency()); currentCurrencyTextView.setTextColor(Color.GRAY); currentCurrencyTextView.setId(currencyId); params = new RelativeLayout.LayoutParams((int) LayoutParams.WRAP_CONTENT, (int) LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.CENTER_HORIZONTAL); if (i != 0) { params.addRule(RelativeLayout.BELOW, recent.getId()); } currentCurrencyTextView.setLayoutParams(params); accLayout.addView(currentCurrencyTextView, params); textViews.add(currentCurrencyTextView); View viewPoint2 = new View(getApplicationContext()); viewPoint2.setBackgroundColor(getResources().getColor(R.color.grey_light)); params = new RelativeLayout.LayoutParams((int) LayoutParams.MATCH_PARENT, 2); params.addRule(RelativeLayout.RIGHT_OF, currencyId); params.addRule(RelativeLayout.LEFT_OF, id); params.setMargins(0, Util.convertDpToPxl(15, getApplicationContext()), 0, 0); if (i != 0) { params.addRule(RelativeLayout.BELOW, recent.getId()); } viewPoint2.setLayoutParams(params); accLayout.addView(viewPoint2, params); TextView currentTextView = new TextView(getApplicationContext()); currentTextView.setText(account.getLiquidity()); currentTextView.setTextColor(Color.GRAY); currentTextView.setId(id); params = new RelativeLayout.LayoutParams((int) LayoutParams.WRAP_CONTENT, (int) LayoutParams.WRAP_CONTENT); if (i != 0) { params.addRule(RelativeLayout.BELOW, recent.getId()); } params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); currentTextView.setLayoutParams(params); recent = currentTextView; accLayout.addView(currentTextView, params); textViews.add(currentTextView); id++; nameID++; viewId1++; currencyId++; } buildUi(false); // Set context EasyTracker.getInstance().setContext(getApplicationContext()); // Instantiate the Tracker tracker = EasyTracker.getTracker(); }
From source file:org.immopoly.android.widget.ImmoscoutPlacesOverlay.java
@Override protected boolean onTap(int index) { if (bubble != null) bubble.detach();//from ww w.ja v a2 s.c o m if (tmpItems == null || index >= tmpItems.size()) { if (mMapFragment instanceof MapFragment) // show wind rose (hack) ((MapFragment) mMapFragment).showCompass(); return false; } final ClusterItem item = tmpItems.get(index); final RelativeLayout.LayoutParams relLayoutParams = new RelativeLayout.LayoutParams( LayoutParams.FILL_PARENT, 210); relLayoutParams.addRule(RelativeLayout.BELOW, R.id.header); bubble = new TeaserView(mMapFragment, mMapView, item.flats, isPortfolio); if (mMapFragment instanceof MapFragment) // hide wind rose (hack) ((MapFragment) mMapFragment).hideCompass(); itemTapTime = System.currentTimeMillis(); // hack to prevent zoom for double tap on item return true; }
From source file:fr.cph.stock.android.activity.EquityActivity.java
@Override public void displayError(JSONObject json) { boolean sessionError = ((StockTrackerApp) getApplication()).isSessionError(json); if (sessionError) { ((StockTrackerApp) getApplication()).loadErrorActivity(this, json); } else {//from w w w . ja va2 s . c o m errorView.setText(json.optString("error")); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) LayoutParams.MATCH_PARENT, (int) LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.BELOW, errorView.getId()); ListView listView = (ListView) findViewById(android.R.id.list); listView.setLayoutParams(params); menuItem.collapseActionView(); menuItem.setActionView(null); } }
From source file:com.xalops.spotifystreamer.fragments.SearchListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a ListView whose id * is {@link android.R.id#list android.R.id.list} and can optionally * have a sibling view id {@link android.R.id#empty android.R.id.empty} * that is to be shown when the list is empty. * * <p>If you are overriding this method with your own custom content, * consider including the standard layout {@link android.R.layout#list_content} * in your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only * way to have the built-in indeterminant progress state be shown. *///from ww w. j av a 2s.c o m @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); //QUICK Inflate from XML file //inflater.inflate(R.layout.search_list_detail, root); // ------------------------------------------------------------------ LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ RelativeLayout rlayout = new RelativeLayout(context); EditText et = new EditText(getActivity()); et.setId(INTERNAL_SEARCH_FIELD_ID); et.setSingleLine(true); et.setInputType(InputType.TYPE_CLASS_TEXT); et.setImeOptions(EditorInfo.IME_ACTION_DONE); RelativeLayout.LayoutParams etRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); RelativeLayout.LayoutParams lframeRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); lframeRLayoutParams.addRule(RelativeLayout.BELOW, INTERNAL_SEARCH_FIELD_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); rlayout.addView(et, etRLayoutParams); rlayout.addView(lframe, lframeRLayoutParams); root.addView(rlayout, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:nz.al4.airclock.AirClockFragment.java
private View setupTz() { // add time zone textTz = new TextView(getContext()); textTz.setId(textTzId);/*from w ww .j ava2 s . c o m*/ RelativeLayout.LayoutParams textTzParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); textTzParams.addRule(RelativeLayout.BELOW, textDateId); textTz.setLayoutParams(textTzParams); textTz.setTypeface(textTz.getTypeface(), Typeface.BOLD); textTz.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); textTz.setGravity(Gravity.CENTER_HORIZONTAL); return textTz; }
From source file:mobisocial.musubi.ui.FeedIdentityGrid.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //TODO: this begs for being in util, huh. i wonder where else it is used. //check that we aren't going to send a message using the local authority //to our friends. This is similar to the initial hidden state of the //person picker on the feed list mDatabaseSource = App.getDatabaseSource(this); mIdentitiesManager = new IdentitiesManager(mDatabaseSource); mFeedManager = new FeedManager(mDatabaseSource); if (mIdentitiesManager.getOwnedIdentities().size() < 2) { Toast.makeText(this, "You must connect an account in Musubi to be able to share with your contacts", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(this, FeedListActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);//from w w w . j a v a 2 s .co m return; } setTitle("Share"); RelativeLayout window = new RelativeLayout(this); LayoutParams fill = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); window.setLayoutParams(fill); // Identity multi-select mIdentitySelector = new MultiIdentitySelector(this); mIdentitySelector.setOnIdentitiesUpdatedListener(mIdentitiesUpdatedListener); mIdentitySelector.setOnRequestAddIdentityListener(mOnRequestAddIdentityListener); RelativeLayout.LayoutParams selectorParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); selectorParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); mIdentitySelector.setLayoutParams(selectorParams); mIdentitySelector.setId(R.id.people); // Feed list mFeedListView = new ListView(this); RelativeLayout.LayoutParams listParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); listParams.addRule(RelativeLayout.BELOW, R.id.people); listParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); mFeedListView.setLayoutParams(listParams); mFeedListView.setOnItemClickListener(mFeedClickListener); // Must be called before setAdapter(): //mFeedListView.addHeaderView(mHeaderView); // Bind to content view window.addView(mIdentitySelector); window.addView(mFeedListView); setContentView(window, fill); getSupportLoaderManager().initLoader(LOAD_FEEDS, null, this); }
From source file:com.tmall.wireless.tangram.view.BannerView.java
public void setIndicatorPos(String isInside) { if ("inside".equals(isInside)) { if (Build.VERSION.SDK_INT >= 17) { mIndicatorLayoutParams.removeRule(RelativeLayout.BELOW); }//from w w w. j a va 2s . c o m mIndicatorLayoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.TANGRAM_BANNER_ID); } else if ("outside".equals(isInside)) { if (Build.VERSION.SDK_INT >= 17) { mIndicatorLayoutParams.removeRule(RelativeLayout.ALIGN_BOTTOM); } mIndicatorLayoutParams.addRule(RelativeLayout.BELOW, R.id.TANGRAM_BANNER_ID); } else { if (Build.VERSION.SDK_INT >= 17) { mIndicatorLayoutParams.removeRule(RelativeLayout.BELOW); } mIndicatorLayoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.TANGRAM_BANNER_ID); } }
From source file:com.smartcodeunited.demo.bluetooth.activity.BaseActivity.java
@Override public void setContentView(int layoutResID) { super.setContentView(layoutResID); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); rootLayout = (RelativeLayout) findViewById(R.id.root); rootLayout.setPadding(0, 0, 0, getNavigationBarHeight()); int titleLayoutRes = getTitleLayoutId(); if (titleLayoutRes > 0) { titleLayout = inflater.inflate(titleLayoutRes, rootLayout, false); titleLayout.setPadding(0, getStatusBarHeight(), 0, 0); if (titleLayoutRes == R.layout.common_title_layout) { initTitleCenterLayout(inflater); }//from w w w. ja v a 2 s . com titleLayout.setId(R.id.title); rootLayout.addView(titleLayout); } View contentView = inflater.inflate(getContentLayoutId(), rootLayout, false); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); if (titleLayout != null) { if (contentView.getTag() == null) { Object tag = contentView.getTag(); params.addRule(RelativeLayout.BELOW, R.id.title); } } rootLayout.addView(contentView, params); if (titleLayout != null && contentView.getTag() == null) { titleLayout.bringToFront(); rootLayout.invalidate(); } leftBtn = findViewById(R.id.btn_left); if (leftBtn != null) { leftBtn.setOnClickListener(this); } rightBtn = findViewById(R.id.btn_right); if (rightBtn != null) { rightBtn.setOnClickListener(this); } titleTv = (TextView) findViewById(R.id.tv_title); rlTitle = findViewById(R.id.rl_title_base); }
From source file:com.google.zxing.client.android.CaptureActivity.java
private void initConView() { mToolView = new ViewToolView(this, mData, toolListener); RelativeLayout.LayoutParams toolParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);//from w w w . j a v a2 s. c o m int top = (int) getResources().getDimension(EUExUtil.getResDimenID("plugin_uexscanner_tool_top")); int left = (int) getResources().getDimension(EUExUtil.getResDimenID("plugin_uexscanner_tool_left")); toolParams.setMargins(left, top, left, 0); mToolView.setId(1); mToolView.setLayoutParams(toolParams); mConRel.addView(mToolView); viewfinderView = new ViewfinderView(this, mData); RelativeLayout.LayoutParams viewParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); viewParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); viewfinderView.setLayoutParams(viewParams); mConRel.addView(viewfinderView); mGalleryPic = new ImageView(this); RelativeLayout.LayoutParams picParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); picParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); picParams.addRule(RelativeLayout.BELOW, 1); picParams.setMargins(left, top, left, top); mGalleryPic.setLayoutParams(picParams); mConRel.addView(mGalleryPic); mGalleryPic.setVisibility(View.GONE); mFailText = new TextView(this); RelativeLayout.LayoutParams failTextParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); failTextParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mFailText.setLayoutParams(failTextParams); mFailText.setGravity(Gravity.CENTER); mFailText.setTextColor(Color.WHITE); mFailText.setTextSize(25); mConRel.addView(mFailText); mFailText.setVisibility(View.GONE); mFailText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mFailText.setVisibility(View.GONE); mGalleryPic.setVisibility(View.GONE); } }); }
From source file:com.mdlive.sav.MDLiveSearchProvider.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.search_provider); clearMinimizedTime();// w w w . j a v a 2 s . co m this.setTitle(getString(R.string.mdl_refine_search)); // Determine the Provider mode final SharedPreferences sharedpreferences = getSharedPreferences( PreferenceConstants.MDLIVE_USER_PREFERENCES, Context.MODE_PRIVATE); String providerMode = sharedpreferences.getString(PreferenceConstants.PROVIDER_MODE, ""); // set CignaCoach-specific flag if (providerMode != null && providerMode.length() > 0 && providerMode.equalsIgnoreCase(MDLiveConfig.PROVIDERTYPE_CIGNACOACH) && MDLiveConfig.CIGNACOACH_ENABLED) { isCignaCoachUser = true; // overwrite text strings ((TextView) findViewById(R.id.txtProviderType)).setText(getString(R.string.mdl_coach_type_hc)); // hide Views not used for Cigna Health Coach findViewById(R.id.dividerLocatedIn).setVisibility(View.GONE); findViewById(R.id.LocatioTxtViewR6).setVisibility(View.GONE); findViewById(R.id.dividerAppointmentDate).setVisibility(View.GONE); findViewById(R.id.AppointmentDateR2).setVisibility(View.GONE); findViewById(R.id.dividerAvailableBy).setVisibility(View.GONE); findViewById(R.id.AvailableByR1).setVisibility(View.GONE); findViewById(R.id.sorttByR4).setVisibility(View.GONE); findViewById(R.id.dividerSorttBy).setVisibility(View.GONE); // re-wire layouts relative dependencies after Views removals View speaks = findViewById(R.id.SpeaksTxtViewR7); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) speaks.getLayoutParams(); View v = findViewById(R.id.dividerSpecialty); params.addRule(RelativeLayout.BELOW, v.getId()); speaks.setLayoutParams(params); View providerType = findViewById(R.id.ProviderTypeTxtViewR3); params = (RelativeLayout.LayoutParams) providerType.getLayoutParams(); v = findViewById(R.id.edt_searchProvider); //params.removeRule(RelativeLayout.BELOW); // available only from API level 17+ params.addRule(RelativeLayout.BELOW, v.getId()); providerType.setLayoutParams(params); View specialtyType = findViewById(R.id.SpecialityTxtViewR5); params = (RelativeLayout.LayoutParams) specialtyType.getLayoutParams(); v = findViewById(R.id.dividerProviderType); //params.removeRule(RelativeLayout.BELOW); // available only from API level 17+ params.addRule(RelativeLayout.BELOW, v.getId()); specialtyType.setLayoutParams(params); } try { setDrawerLayout((DrawerLayout) findViewById(R.id.drawer_layout)); final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar); elevateToolbar(toolbar); } } catch (Exception e) { e.printStackTrace(); } ((ImageView) findViewById(R.id.backImg)).setImageResource(R.drawable.back_arrow_hdpi); findViewById(R.id.backImg).setContentDescription(getString(R.string.mdl_ada_back_button)); ((ImageView) findViewById(R.id.txtApply)).setImageResource(R.drawable.top_tick_icon); findViewById(R.id.txtApply).setContentDescription(getString(R.string.mdl_ada_tick_button)); ((TextView) findViewById(R.id.headerTxt)).setText(getString(R.string.mdl_refine_search)); initialiseData(); ((TextView) findViewById(R.id.ProviderTypeTxtView)) .setText(sharedpreferences.getString(PreferenceConstants.PROVIDER_MODE, "Any")); //Load Services SharedPreferences searchPref = this.getSharedPreferences("SearchPref", 0); SavedLocation = searchPref.getString(PreferenceConstants.SEARCHFILTER_LONGNAME_LOCATION_PREFERENCES, null); filter_SavedLocation = searchPref.getString(PreferenceConstants.ZIPCODE_PREFERENCES, null); LocationTxtView.setText(SavedLocation); loadSearchproviderDetails(); }