List of usage examples for android.widget LinearLayout VERTICAL
int VERTICAL
To view the source code for android.widget LinearLayout VERTICAL.
Click Source Link
From source file:org.quantumbadger.redreader.activities.ImageViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences); if (solidblack) getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK)); final Intent intent = getIntent(); mUrl = General.uriFromString(intent.getDataString()); final RedditPost src_post = intent.getParcelableExtra("post"); if (mUrl == null) { General.quickToast(this, "Invalid URL. Trying web browser."); revertToWeb();/*from w w w. ja v a2 s . c o m*/ return; } Log.i("ImageViewActivity", "Loading URL " + mUrl.toString()); final ProgressBar progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal); final LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(progressBar); CacheManager.getInstance(this) .makeRequest(mRequest = new CacheRequest(mUrl, RedditAccountManager.getAnon(), null, Constants.Priority.IMAGE_VIEW, 0, CacheRequest.DownloadType.IF_NECESSARY, Constants.FileType.IMAGE, false, false, false, this) { private void setContentView(View v) { layout.removeAllViews(); layout.addView(v); v.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; v.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT; } @Override protected void onCallbackException(Throwable t) { BugReportActivity.handleGlobalError(context.getApplicationContext(), new RRError(null, null, t)); } @Override protected void onDownloadNecessary() { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { @Override public void run() { progressBar.setVisibility(View.VISIBLE); progressBar.setIndeterminate(true); } }); } @Override protected void onDownloadStarted() { } @Override protected void onFailure(final RequestFailureType type, Throwable t, StatusLine status, final String readableMessage) { final RRError error = General.getGeneralErrorForFailure(context, type, t, status, url.toString()); AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { // TODO handle properly mRequest = null; progressBar.setVisibility(View.GONE); layout.addView(new ErrorView(ImageViewActivity.this, error)); } }); } @Override protected void onProgress(final boolean authorizationInProgress, final long bytesRead, final long totalBytes) { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { @Override public void run() { progressBar.setVisibility(View.VISIBLE); progressBar.setIndeterminate(authorizationInProgress); progressBar.setProgress((int) ((100 * bytesRead) / totalBytes)); } }); } @Override protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, long timestamp, UUID session, boolean fromCache, final String mimetype) { if (mimetype == null || (!Constants.Mime.isImage(mimetype) && !Constants.Mime.isVideo(mimetype))) { revertToWeb(); return; } final InputStream cacheFileInputStream; try { cacheFileInputStream = cacheFile.getInputStream(); } catch (IOException e) { notifyFailure(RequestFailureType.PARSE, e, null, "Could not read existing cached image."); return; } if (cacheFileInputStream == null) { notifyFailure(RequestFailureType.CACHE_MISS, null, null, "Could not find cached image"); return; } if (Constants.Mime.isVideo(mimetype)) { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { if (mIsDestroyed) return; mRequest = null; try { final RelativeLayout layout = new RelativeLayout(context); layout.setGravity(Gravity.CENTER); final VideoView videoView = new VideoView(ImageViewActivity.this); videoView.setVideoURI(cacheFile.getUri()); layout.addView(videoView); setContentView(layout); layout.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; layout.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT; videoView.setLayoutParams( new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.setLooping(true); videoView.start(); } }); videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(final MediaPlayer mediaPlayer, final int i, final int i1) { revertToWeb(); return true; } }); videoView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(final View view, final MotionEvent motionEvent) { finish(); return true; } }); } catch (OutOfMemoryError e) { General.quickToast(context, R.string.imageview_oom); revertToWeb(); } catch (Throwable e) { General.quickToast(context, R.string.imageview_invalid_video); revertToWeb(); } } }); } else if (Constants.Mime.isImageGif(mimetype)) { final PrefsUtility.GifViewMode gifViewMode = PrefsUtility .pref_behaviour_gifview_mode(context, sharedPreferences); if (gifViewMode == PrefsUtility.GifViewMode.INTERNAL_BROWSER) { revertToWeb(); return; } else if (gifViewMode == PrefsUtility.GifViewMode.EXTERNAL_BROWSER) { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { @Override public void run() { LinkHandler.openWebBrowser(ImageViewActivity.this, Uri.parse(mUrl.toString())); finish(); } }); return; } if (AndroidApi.isIceCreamSandwichOrLater() && gifViewMode == PrefsUtility.GifViewMode.INTERNAL_MOVIE) { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { if (mIsDestroyed) return; mRequest = null; try { final GIFView gifView = new GIFView(ImageViewActivity.this, cacheFileInputStream); setContentView(gifView); gifView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); } catch (OutOfMemoryError e) { General.quickToast(context, R.string.imageview_oom); revertToWeb(); } catch (Throwable e) { General.quickToast(context, R.string.imageview_invalid_gif); revertToWeb(); } } }); } else { gifThread = new GifDecoderThread(cacheFileInputStream, new GifDecoderThread.OnGifLoadedListener() { public void onGifLoaded() { AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { if (mIsDestroyed) return; mRequest = null; imageView = new ImageView(context); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER); setContentView(imageView); gifThread.setView(imageView); imageView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); } }); } public void onOutOfMemory() { General.quickToast(context, R.string.imageview_oom); revertToWeb(); } public void onGifInvalid() { General.quickToast(context, R.string.imageview_invalid_gif); revertToWeb(); } }); gifThread.start(); } } else { final ImageTileSource imageTileSource; try { final long bytes = cacheFile.getSize(); final byte[] buf = new byte[(int) bytes]; try { new DataInputStream(cacheFileInputStream).readFully(buf); } catch (IOException e) { throw new RuntimeException(e); } try { imageTileSource = new ImageTileSourceWholeBitmap(buf); } catch (Throwable t) { Log.e("ImageViewActivity", "Exception when creating ImageTileSource", t); General.quickToast(context, R.string.imageview_decode_failed); revertToWeb(); return; } } catch (OutOfMemoryError e) { General.quickToast(context, R.string.imageview_oom); revertToWeb(); return; } AndroidApi.UI_THREAD_HANDLER.post(new Runnable() { public void run() { if (mIsDestroyed) return; mRequest = null; mImageViewDisplayerManager = new ImageViewDisplayListManager(imageTileSource, ImageViewActivity.this); surfaceView = new RRGLSurfaceView(ImageViewActivity.this, mImageViewDisplayerManager); setContentView(surfaceView); surfaceView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); if (mIsPaused) { surfaceView.onPause(); } else { surfaceView.onResume(); } } }); } } }); final RedditPreparedPost post = src_post == null ? null : new RedditPreparedPost(this, CacheManager.getInstance(this), 0, src_post, -1, false, false, false, false, RedditAccountManager.getInstance(this).getDefaultAccount(), false); final FrameLayout outerFrame = new FrameLayout(this); outerFrame.addView(layout); if (post != null) { final SideToolbarOverlay toolbarOverlay = new SideToolbarOverlay(this); final BezelSwipeOverlay bezelOverlay = new BezelSwipeOverlay(this, new BezelSwipeOverlay.BezelSwipeListener() { public boolean onSwipe(BezelSwipeOverlay.SwipeEdge edge) { toolbarOverlay.setContents( post.generateToolbar(ImageViewActivity.this, false, toolbarOverlay)); toolbarOverlay.show(edge == BezelSwipeOverlay.SwipeEdge.LEFT ? SideToolbarOverlay.SideToolbarPosition.LEFT : SideToolbarOverlay.SideToolbarPosition.RIGHT); return true; } public boolean onTap() { if (toolbarOverlay.isShown()) { toolbarOverlay.hide(); return true; } return false; } }); outerFrame.addView(bezelOverlay); outerFrame.addView(toolbarOverlay); bezelOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; bezelOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; toolbarOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; toolbarOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT; } setContentView(outerFrame); }
From source file:com.inter.trade.view.slideplayview.AbSlidingPlayView.java
/** * //from w w w . j av a2 s. co m * ???View * @param context * @throws */ public void initView(Context context) { this.context = context; layoutParamsFF = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); layoutParamsFW = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); layoutParamsWF = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT); pageLineLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); this.setOrientation(LinearLayout.VERTICAL); //this.setBackgroundColor(Color.rgb(255, 255, 255)); RelativeLayout mRelativeLayout = new RelativeLayout(context); mViewPager = new AbInnerViewPager(context); //ViewPager,fragmentsetId()id mViewPager.setId(1985); // mPageLineLayoutParent = new LinearLayout(context); mPageLineLayoutParent.setPadding(0, 5, 0, 5); pageLineLayout = new LinearLayout(context); pageLineLayout.setPadding(15, 1, 15, 1); pageLineLayout.setVisibility(View.INVISIBLE); mPageLineLayoutParent.addView(pageLineLayout, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); lp1.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); mRelativeLayout.addView(mViewPager, lp1); RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp2.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); mRelativeLayout.addView(mPageLineLayoutParent, lp2); addView(mRelativeLayout, layoutParamsFW); displayImage = AbFileUtil.getBitmapFormSrc("image/play_display.png"); hideImage = AbFileUtil.getBitmapFormSrc("image/play_hide.png"); mListViews = new ArrayList<View>(); mAbViewPagerAdapter = new AbViewPagerAdapter(context, mListViews); mViewPager.setAdapter(mAbViewPagerAdapter); mViewPager.setFadingEdgeLength(0); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { makesurePosition(); onPageSelectedCallBack(position); } @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { onPageScrolledCallBack(position); } }); }
From source file:android.support.v7ox.widget.ButtonBarLayout.java
private boolean isStacked() { return getOrientation() == LinearLayout.VERTICAL; }
From source file:de.gebatzens.sia.fragment.RemoteDataFragment.java
public void createMessage(ViewGroup l, String text, String button, View.OnClickListener onclick) { RelativeLayout r = new RelativeLayout(getActivity()); r.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); LinearLayout l2 = new LinearLayout(getActivity()); l2.setOrientation(LinearLayout.VERTICAL); RelativeLayout.LayoutParams layoutparams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutparams.addRule(RelativeLayout.CENTER_VERTICAL); l2.setLayoutParams(layoutparams);//from w w w. j a v a 2 s . c om l2.setGravity(Gravity.CENTER_HORIZONTAL); TextView tv = new TextView(getActivity()); LinearLayout.LayoutParams tvparams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); tv.setLayoutParams(tvparams); tv.setText(text); tv.setTextSize(23); tv.setPadding(0, 0, 0, toPixels(15)); l2.addView(tv); if (button != null) { Button b = new Button(getActivity()); LinearLayout.LayoutParams bparams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); bparams.setMargins(toPixels(4), toPixels(0), toPixels(4), toPixels(4)); 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); l2.addView(b); } r.addView(l2); l.addView(r); }
From source file:com.google.android.gcm.demo.ui.GroupsFragment.java
@Override public void refresh() { float density = getActivity().getResources().getDisplayMetrics().density; SimpleArrayMap<String, Sender> senders = mSenders.getSenders(); LinearLayout sendersList = new LinearLayout(getActivity()); sendersList.setOrientation(LinearLayout.VERTICAL); for (int i = 0; i < senders.size(); i++) { Sender sender = senders.valueAt(i); if (sender.groups.size() > 0) { LinearLayout senderRow = (LinearLayout) getActivity().getLayoutInflater() .inflate(R.layout.widget_icon_text_button_row, sendersList, false); ImageView senderIcon = (ImageView) senderRow.findViewById(R.id.widget_itbr_icon); TextView senderText = (TextView) senderRow.findViewById(R.id.widget_itbr_text); senderRow.findViewById(R.id.widget_itbr_button).setVisibility(View.GONE); senderIcon.setImageResource(R.drawable.cloud_googblue); senderIcon.setPadding(0, 0, (int) (8 * density), 0); senderText.setText(getString(R.string.groups_sender_id, sender.senderId)); sendersList.addView(senderRow); for (DeviceGroup deviceGroup : sender.groups.values()) { LinearLayout row = (LinearLayout) getActivity().getLayoutInflater() .inflate(R.layout.widget_icon_text_button_row, sendersList, false); ImageView icon = (ImageView) row.findViewById(R.id.widget_itbr_icon); TextView label = (TextView) row.findViewById(R.id.widget_itbr_text); Button button = (Button) row.findViewById(R.id.widget_itbr_button); icon.setImageResource(R.drawable.group_grey600); label.setText(deviceGroup.notificationKeyName); label.setBackgroundResource(selectableBackgroundResource); label.setTag(R.id.tag_action, ACTION_OPEN_GROUP); label.setTag(R.id.tag_senderid, sender.senderId); label.setTag(R.id.tag_group, deviceGroup.notificationKeyName); label.setOnClickListener(this); button.setText(R.string.groups_delete); button.setTag(R.id.tag_action, ACTION_DELETE_GROUP); button.setTag(R.id.tag_senderid, sender.senderId); button.setTag(R.id.tag_group, deviceGroup.notificationKeyName); button.setOnClickListener(this); row.setPadding((int) (16 * density), 0, 0, 0); sendersList.addView(row); }/*from w w w . j a v a 2s. co m*/ } } if (sendersList.getChildCount() == 0) { TextView noTokens = new TextView(getActivity()); noTokens.setText(getString(R.string.groups_no_groups_available)); noTokens.setTypeface(null, Typeface.ITALIC); sendersList.addView(noTokens); } FrameLayout topicsView = (FrameLayout) getActivity().findViewById(R.id.groups_list_wrapper); topicsView.removeAllViews(); topicsView.addView(sendersList); }
From source file:mobisocial.musubi.objects.IntroductionObj.java
@Override public View createView(Context context, ViewGroup frame) { LinearLayout wrap = new LinearLayout(context); wrap.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); wrap.setOrientation(LinearLayout.VERTICAL); wrap.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); wrap.setEnabled(false);// ww w. j a v a2s.com wrap.setFocusableInTouchMode(false); wrap.setFocusable(false); wrap.setClickable(false); TextView title = new TextView(context); title.setText(R.string.introduced); title.setTypeface(null, Typeface.BOLD); title.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); wrap.addView(title); Gallery intro = new Gallery(context); intro.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); hackGalleryInit(context, intro); wrap.addView(intro); return wrap; }
From source file:be.ugent.zeus.hydra.views.ButtonBarLayout.java
private void setStacked(boolean stacked) { setOrientation(stacked ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL); setGravity(stacked ? Gravity.RIGHT : Gravity.BOTTOM); final View spacer = findViewById(android.support.v7.appcompat.R.id.spacer); if (spacer != null) { spacer.setVisibility(stacked ? View.GONE : View.INVISIBLE); }//from ww w.jav a2s. com // Reverse the child order. This is specific to the Material button // bar's layout XML and will probably not generalize. final int childCount = getChildCount(); for (int i = childCount - 2; i >= 0; i--) { bringChildToFront(getChildAt(i)); } }
From source file:com.krayzk9s.imgurholo.ui.AlbumsFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // handle item selection Activity activity = getActivity();/*from w w w. j a va 2 s . c o m*/ switch (item.getItemId()) { case R.id.action_refresh: urls = new ArrayList<String>(); imageAdapter.notifyDataSetChanged(); getImages(); return true; case R.id.action_new: final EditText newTitle = new EditText(activity); newTitle.setSingleLine(); newTitle.setHint(R.string.hint_album_title); final EditText newDescription = new EditText(activity); newDescription.setHint(R.string.body_hint_description); LinearLayout linearLayout = new LinearLayout(activity); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.addView(newTitle); linearLayout.addView(newDescription); new AlertDialog.Builder(activity).setTitle(R.string.dialog_new_album_title).setView(linearLayout) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { NewAlbumAsync messagingAsync = new NewAlbumAsync(newTitle.getText().toString(), newDescription.getText().toString(), ((ImgurHoloActivity) getActivity()).getApiCall(), null, null); messagingAsync.execute(); } }).setNegativeButton(R.string.dialog_answer_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Do nothing. } }).show(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:net.gaast.giggity.ChooserActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //this.setTheme(android.R.style.Theme_Holo); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_PROGRESS); /*//test stuff// ww w . j a va 2 s . c o m Vibrator v = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); long[] pattern = { }; v.vibrate(pattern, -1); */ Giggity app = (Giggity) getApplication(); db = app.getDb(); pref = PreferenceManager.getDefaultSharedPreferences(app); refreshSeed(false); list = new ListView(this); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { DbSchedule item = (DbSchedule) lista.getItem(position); if (item != null) { openSchedule(item, false); } } }); list.setLongClickable(true); list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { AdapterContextMenuInfo mi = (AdapterContextMenuInfo) menuInfo; DbSchedule sched = (DbSchedule) lista.getItem((int) mi.id); if (sched != null) { menu.setHeaderTitle(sched.getTitle()); menu.add(ContextMenu.NONE, 0, 0, R.string.refresh); menu.add(ContextMenu.NONE, 3, 0, R.string.unhide); menu.add(ContextMenu.NONE, 1, 0, R.string.remove); menu.add(ContextMenu.NONE, 2, 0, R.string.show_url); } } }); /* Filling in the list in onResume(). */ refresher = new SwipeRefreshLayout(this); refresher.setOnRefreshListener(this); refresher.addView(list); LinearLayout cont = new LinearLayout(this); cont.setOrientation(LinearLayout.VERTICAL); cont.addView(refresher, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1)); setContentView(cont); }
From source file:com.bslee.logtoolapk.widget.FragmentTabHost.java
@Deprecated private void initFragmentTabHost(Context context, AttributeSet attrs) { TypedArray a = context.obtainStyledAttributes(attrs, new int[] { android.R.attr.inflatedId }, 0, 0); mContainerId = a.getResourceId(0, 0); a.recycle();//from w w w . j av a 2 s . com super.setOnTabChangedListener(this); if (findViewById(android.R.id.tabs) == null) { LinearLayout ll = new LinearLayout(context); ll.setOrientation(LinearLayout.VERTICAL); addView(ll, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); TabWidget tw = new TabWidget(context); tw.setId(android.R.id.tabs); tw.setOrientation(TabWidget.HORIZONTAL); ll.addView(tw, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0)); FrameLayout fl = new FrameLayout(context); fl.setId(android.R.id.tabcontent); ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0)); mRealTabContent = fl = new FrameLayout(context); mRealTabContent.setId(mContainerId); ll.addView(fl, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, 0, 1)); } }