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:com.bangqu.eshow.view.sliding.ESBottomTabView.java
/** * Instantiates a new ab bottom tab view. * * @param context the context/* w w w .jav a 2s.co m*/ * @param attrs the attrs */ public ESBottomTabView(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; this.setOrientation(LinearLayout.VERTICAL); this.setBackgroundColor(Color.rgb(255, 255, 255)); mTabLayout = new LinearLayout(context); mTabLayout.setOrientation(LinearLayout.HORIZONTAL); mTabLayout.setGravity(Gravity.CENTER); //View? mViewPager = new ESViewPager(context); //ViewPager,setId()id mViewPager.setId(1985); pagerItemList = new ArrayList<Fragment>(); this.addView(mViewPager, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0, 1)); //? mTabImg = new ImageView(context); mTabImg.setBackgroundColor(tabSlidingColor); this.addView(mTabImg, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, tabSlidingHeight)); this.addView(mTabLayout, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); //Tab? tabItemList = new ArrayList<ESTabItemView>(); tabItemTextList = new ArrayList<String>(); tabItemDrawableList = new ArrayList<Drawable>(); //?FragmentActivity if (!(this.context instanceof FragmentActivity)) { ESLogUtil.e(ESBottomTabView.class, "AbSlidingTabView?context,FragmentActivity"); } DisplayMetrics mDisplayMetrics = ESAppUtil.getDisplayMetrics(context); mWidth = mDisplayMetrics.widthPixels; FragmentManager mFragmentManager = ((FragmentActivity) this.context).getFragmentManager(); mFragmentPagerAdapter = new ESFragmentPagerAdapter(mFragmentManager, pagerItemList); mViewPager.setAdapter(mFragmentPagerAdapter); mViewPager.setOnPageChangeListener(new MyOnPageChangeListener()); mViewPager.setOffscreenPageLimit(3); }
From source file:android.support.v13.app.FragmentTabHost.java
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();//w w w .j a v a2 s. c o m super.setOnTabChangedListener(this); // If owner hasn't made its own view hierarchy, then as a convenience // we will construct a standard one here. 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)); } }
From source file:org.quantumbadger.redreader.activities.InboxListingActivity.java
@Override public void onCreate(Bundle savedInstanceState) { PrefsUtility.applyTheme(this); super.onCreate(savedInstanceState); final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences) && PrefsUtility.appearance_theme(this, sharedPreferences) == PrefsUtility.AppearanceTheme.NIGHT; getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); final String title; isModmail = getIntent() != null && getIntent().getBooleanExtra("modmail", false); if (!isModmail) { title = getString(R.string.mainmenu_inbox); } else {//from w w w . j a va 2 s . com title = getString(R.string.mainmenu_modmail); } OptionsMenuUtility.fixActionBar(this, title); headerItems = PrefsUtility.appearance_comment_header_items(this, sharedPreferences); headerItems.remove(PrefsUtility.AppearanceCommentHeaderItems.SCORE); final LinearLayout outer = new LinearLayout(this); outer.setOrientation(android.widget.LinearLayout.VERTICAL); if (solidblack) { outer.setBackgroundColor(Color.BLACK); } loadingView = new LoadingView(this, getString(R.string.download_waiting), true, true); notifications = new LinearLayout(this); notifications.setOrientation(android.widget.LinearLayout.VERTICAL); notifications.addView(loadingView); final ListView lv = new ListView(this); lv.setSmoothScrollbarEnabled(false); lv.setVerticalFadingEdgeEnabled(false); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final Object item = lv.getAdapter().getItem(position); if (item != null && item instanceof RedditPreparedInboxItem) { ((RedditPreparedInboxItem) item).handleInboxClick(InboxListingActivity.this); } } }); adapter = new InboxListingAdapter(this, this); lv.setAdapter(adapter); registerForContextMenu(lv); outer.addView(notifications); outer.addView(lv); makeFirstRequest(this); setContentView(outer); }
From source file:org.odk.collect.android.widgets.ArbitraryFileWidget.java
private void setUpLayout() { LinearLayout widgetLayout = new LinearLayout(getContext()); widgetLayout.setOrientation(LinearLayout.VERTICAL); chooseFileButton = getSimpleButton(getContext().getString(R.string.choose_file)); chooseFileButton.setEnabled(!getFormEntryPrompt().isReadOnly()); answerLayout = new LinearLayout(getContext()); answerLayout.setOrientation(LinearLayout.HORIZONTAL); answerLayout.setGravity(Gravity.CENTER); ImageView attachmentImg = new ImageView(getContext()); attachmentImg.setImageResource(R.drawable.ic_attachment); chosenFileNameTextView = getAnswerTextView(binaryName); chosenFileNameTextView.setGravity(Gravity.CENTER); answerLayout.addView(attachmentImg); answerLayout.addView(chosenFileNameTextView); answerLayout.setVisibility(binaryName == null ? GONE : VISIBLE); answerLayout.setOnClickListener(view -> openFile()); widgetLayout.addView(chooseFileButton); widgetLayout.addView(answerLayout);/* w w w . j a va2 s. c o m*/ addAnswerView(widgetLayout); }
From source file:foam.jellyfish.StarwispBuilder.java
public int BuildOrientation(String p) { if (p.equals("vertical")) return LinearLayout.VERTICAL; if (p.equals("horizontal")) return LinearLayout.HORIZONTAL; return LinearLayout.VERTICAL; }
From source file:alexander.martinz.libs.materialpreferences.MaterialEditTextPreference.java
protected AlertDialog createAlertDialog() { final Context context = getContext(); final AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(getTitle());// w w w .ja v a2s. c om // create the wrapper layout to apply margins to the edit text final LinearLayout wrapper = new LinearLayout(context); wrapper.setOrientation(LinearLayout.VERTICAL); final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); final int margin = (int) convertDpToPixels(10); layoutParams.setMargins(margin, 0, margin, 0); // create the EditText and add it to the wrapper layout final EditText editText = new EditText(context); editText.setText(mValue); wrapper.addView(editText, layoutParams); // set our wrapper as view builder.setView(wrapper); builder.setNegativeButton(android.R.string.cancel, null); builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final String value = editText.getText().toString(); if (TextUtils.equals(value, mValue)) { // the value did not change, so lets end here return; } mValue = value; final MaterialEditTextPreference preference = MaterialEditTextPreference.this; if (mListener != null) { if (mListener.onPreferenceChanged(preference, mValue)) { setText(mValue); } } else { setText(mValue); } } }); return builder.create(); }
From source file:com.huewu.pla.lib.MultiColumnListFragment.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./* w w w . j a va2 s . c o m*/ * * <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. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final 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)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final 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)); final MultiColumnListView lv = createMultiColumnListView(context, inflater); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(lframe, 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:com.readboy.mathproblem.app.ExpandableListFragment.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 a v a2 s .c o m*/ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ 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.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ /*ExpandableListView expandableListView = (ExpandableListView) View.inflate( getActivity(), R.layout.expandable_gradelist, lframe);*/ // ------------------------------------------------------------------ ExpandableListView lv = new ExpandableListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); // ------------------------------------------------------------------ /* ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));*/ // ------------------------------------------------------------------ root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); return root; }
From source file:net.granoeste.scaffold.app.ScaffoldWebViewFragment.java
@SuppressLint("SetJavaScriptEnabled") @Override//from w ww. j a va2 s .c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); FrameLayout root = new FrameLayout(getActivity()); // ------------------ // Progress content // ------------------ mPFrame = new LinearLayout(getActivity()); mPFrame.setId(INTERNAL_PROGRESS_CONTAINER_ID); mPFrame.setOrientation(LinearLayout.VERTICAL); mPFrame.setGravity(Gravity.CENTER); ProgressBar progress = new ProgressBar(getActivity(), null, android.R.attr.progressBarStyleLarge); mPFrame.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); // ---------------- // WebView content // ---------------- mCFrame = new FrameLayout(getActivity()); mCFrame.setId(INTERNAL_CONTENT_CONTAINER_ID); mWebView = new InternalWebView(getActivity()); mWebView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); mWebView.getSettings().setJavaScriptEnabled(true); // Flash Support if (UIUtils.hasKitkat()) { // Flash(4.4?????) } else if (UIUtils.hasJellyBeanMr2()) { mWebView.getSettings().setPluginState(WebSettings.PluginState.ON); } else if (UIUtils.hasFroyo()) { // Deprecated Since API level 9, and removed in API level 18 (JellyBeanMr2) // mWebView.getSettings().setPluginEnabled(true); } // mWebView.getSettings().setVerticalScrollbarOverlay(true); mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); // ? mWebView.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setType(mimetype); intent.setData(Uri.parse(url)); startActivity(intent); } }); mWebView.setWebViewClient(new InternalWebViewClient(root, mCallbacks)); mCFrame.addView(mWebView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.addView(mCFrame, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(mPFrame, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:de.gebatzens.ggvertretungsplan.fragment.MensaFragment.java
@Override public void createView(LayoutInflater inflater, ViewGroup view) { Display display = ((WindowManager) getActivity().getApplicationContext() .getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int rotation = display.getRotation(); Log.d("Screen orientation", String.valueOf(rotation)); if ((rotation == 3) || (rotation == 1)) { screen_orientation_horizotal = true; } else {/*from ww w . j ava 2 s . c om*/ screen_orientation_horizotal = false; } final ScrollView sv = new ScrollView(getActivity()); sv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); sv.setTag("mensa_scroll"); ((LinearLayout) view.findViewById(R.id.mensa_content)).addView(sv); final LinearLayout l = new LinearLayout(getActivity()); l.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); l.setOrientation(LinearLayout.VERTICAL); int p = toPixels(6); l.setPadding(p, p, p, p); sv.addView(l); for (Mensa.MensaItem item : GGApp.GG_APP.mensa) { if (!item.isPast()) l.addView(createCardItem(item, inflater)); } }