List of usage examples for android.widget RelativeLayout addView
public void addView(View child, int width, int height)
From source file:net.wequick.small.webkit.WebActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int theme = Small.getWebActivityTheme(); if (theme != 0) setTheme(theme);//from w w w. jav a 2 s. com boolean fullscreen = false; CharSequence queryTitle; Uri uri = Small.getUri(this); if (uri != null) { String param = uri.getQueryParameter("_fullscreen"); if (param != null) { fullscreen = param.equals("1"); } queryTitle = uri.getQueryParameter("_title"); if (queryTitle != null) { super.setTitle(queryTitle); mCanSetTitle = false; } } // Init actionBar ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { if (fullscreen) { actionBar.hide(); } else { actionBar.show(); Activity parent = getParent(); if (parent == null) { // If is created by a LocalActivityManager, parent is not null actionBar.setDisplayHomeAsUpEnabled(true); } } } mFullscreen = fullscreen; // Initialize content wrapper RelativeLayout wrapper = new RelativeLayout(this); wrapper.setGravity(Gravity.CENTER); setContentView(wrapper); // Initialize webView mWebView = new WebView(this); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); wrapper.addView(mWebView, 0, layoutParams); // Try to load title from cache mUrl = getIntent().getStringExtra("url"); if (mCanSetTitle) { CharSequence title = getCacheTitle(mUrl); if (title != null) { super.setTitle(title); } } }
From source file:im.vector.activity.CallViewActivity.java
/** * Insert the callView in the activity (above the other room member) * @param avatarUrl the other member avatar *///from w ww . ja v a 2 s . co m private void insertCallView(String avatarUrl) { ImageView avatarView = (ImageView) CallViewActivity.this.findViewById(R.id.call_other_member); avatarView.setImageResource(R.drawable.ic_contact_picture_holo_light); if (!TextUtils.isEmpty(avatarUrl)) { int size = CallViewActivity.this.getResources().getDimensionPixelSize(R.dimen.member_list_avatar_size); mSession.getMediasCache().loadAvatarThumbnail(mSession.getHomeserverConfig(), avatarView, avatarUrl, size); } RelativeLayout layout = (RelativeLayout) CallViewActivity.this.findViewById(R.id.call_layout); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); layout.addView(mCallView, 1, params); mCall.setVisibility(View.GONE); }