List of usage examples for android.widget LinearLayout LinearLayout
public LinearLayout(Context context)
From source file:com.b44t.ui.Components.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context) { super(context); setFillViewport(true);/* w ww. j a v a 2 s .c om*/ setWillNotDraw(false); tabsContainer = new LinearLayout(context); tabsContainer.setOrientation(LinearLayout.HORIZONTAL); tabsContainer.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); addView(tabsContainer); rectPaint = new Paint(); rectPaint.setAntiAlias(true); rectPaint.setStyle(Style.FILL); defaultTabLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutHelper.MATCH_PARENT); }
From source file:com.github.capone.controller.favorites.FavoritesFragment.java
@Override public void onClick(View v) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); final EditText name = new EditText(getActivity()); name.setHint(R.string.server_name);// w w w . ja v a2s . c om final EditText address = new EditText(getActivity()); address.setHint(R.string.server_address); final EditText publicKey = new EditText(getActivity()); publicKey.setHint(R.string.public_key); LinearLayout layout = new LinearLayout(getActivity()); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(name, params); layout.addView(address, params); layout.addView(publicKey, params); new AlertDialog.Builder(getActivity()).setTitle(R.string.title_add_favorite) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { addServer(name.getText().toString(), address.getText().toString(), publicKey.getText().toString()); } }).setView(layout).show(); }
From source file:com.userhook.view.UHMessageView.java
private void init(Context context) { if (!isInEditMode()) { overlay = new LinearLayout(context); // set a transparent black background overlay.setBackgroundColor(Color.parseColor("#99000000")); overlay.setVisibility(GONE);/* w w w.j a v a 2 s . c o m*/ addView(overlay, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); overlay.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { hideDialog(); } }); } }
From source file:illab.nabal.proxy.AuthWebDialog.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // prepare web view layout mLayout = new LinearLayout(getContext()); mLayout.setOrientation(LinearLayout.VERTICAL); // set up title bar setUpTitle();/*from w w w .ja v a2 s . co m*/ // set up web view setUpWebView(); // determine screen width and height DisplayMetrics displaymetrics = new DisplayMetrics(); getWindow().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int screenWidth = displaymetrics.widthPixels; int screenHeight = displaymetrics.heightPixels; // add layout to screen LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams((int) (screenWidth * 0.90), (int) (screenHeight * 0.90)); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(mLayout, layoutParams); }
From source file:com.uzmap.pkg.uzmodules.uzBMap.mode.Billboard.java
@SuppressWarnings("deprecation") public View billboardView() { LinearLayout billboardLayout = new LinearLayout(context); LayoutParams layoutParams = null;//from w ww . ja v a 2 s . c o m if (bgImg != null) { billboardLayout.setBackgroundDrawable(new BitmapDrawable(bgImg)); layoutParams = new LayoutParams(UZCoreUtil.dipToPix(width), UZCoreUtil.dipToPix(height)); } else { billboardLayout.setBackgroundResource(UZResourcesIDFinder.getResDrawableID("mo_bmap_popupmap")); layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, UZCoreUtil.dipToPix(height)); } billboardLayout.setLayoutParams(layoutParams); billboardLayout.setOrientation(LinearLayout.HORIZONTAL); if (getIconAlign().equals("left")) { if (iconStr != null && !iconStr.isEmpty()) billboardLayout.addView(icon()); billboardLayout.addView(titleLayout()); } else { billboardLayout.addView(titleLayout()); if (iconStr != null && !iconStr.isEmpty()) billboardLayout.addView(icon()); } return billboardLayout; }
From source file:com.codeslap.topy.BaseMultiPaneActivity.java
public View getTwoColumns(Fragment firstFragment, float firstWeight, Fragment secondFragment, float secondWeight) { LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(LinearLayout.HORIZONTAL); int firstId = 1; int secondId = 2; FrameLayout firstLayout = new FrameLayout(this); LinearLayout.LayoutParams firstParams = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.FILL_PARENT); firstParams.weight = firstWeight;/* w w w. j av a 2 s. com*/ firstLayout.setLayoutParams(firstParams); firstLayout.setId(firstId); FrameLayout secondLayout = new FrameLayout(this); LinearLayout.LayoutParams secondParams = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.FILL_PARENT); secondLayout.setLayoutParams(secondParams); secondParams.weight = secondWeight; secondLayout.setId(secondId); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.add(firstId, firstFragment); ft.add(2, secondFragment); ft.commit(); linearLayout.addView(firstLayout); linearLayout.addView(secondLayout); return linearLayout; }
From source file:com.geecko.QuickLyric.AboutActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); int[] themes = new int[] { R.style.Theme_QuickLyric, R.style.Theme_QuickLyric_Red, R.style.Theme_QuickLyric_Purple, R.style.Theme_QuickLyric_Indigo, R.style.Theme_QuickLyric_Green, R.style.Theme_QuickLyric_Lime, R.style.Theme_QuickLyric_Brown, R.style.Theme_QuickLyric_Dark }; int themeNum = Integer.valueOf(sharedPref.getString("pref_theme", "0")); boolean nightMode = sharedPref.getBoolean("pref_night_mode", false); if (nightMode && NightTimeVerifier.check(this)) setTheme(R.style.Theme_QuickLyric_Night); else//from w w w . j a v a 2 s.c o m setTheme(themes[themeNum]); TypedValue primaryColor = new TypedValue(); getTheme().resolveAttribute(R.attr.colorPrimary, primaryColor, true); setStatusBarColor(null); LinearLayout linearLayout = new LinearLayout(this); linearLayout.setOrientation(LinearLayout.VERTICAL); Toolbar toolbar = new Toolbar(this); toolbar.setTitle(R.string.pref_about); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) toolbar.setElevation(8f); toolbar.setBackgroundColor(primaryColor.data); toolbar.setTitleTextColor(Color.WHITE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription(null, null, primaryColor.data); this.setTaskDescription(taskDescription); } View.OnClickListener productTourAction = new View.OnClickListener() { @Override public void onClick(View v) { setupDemoScreen(); } }; Element productTourElement = new Element().setTitle(getString(R.string.about_product_tour)); productTourElement.setOnClickListener(productTourAction); Element crowdinElement = new Element().setTitle(getString(R.string.about_crowdin)); crowdinElement .setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("https://crowdin.com/project/quicklyric"))); Element ossLicensesElement = new Element().setTitle("Open Source Licenses"); ossLicensesElement.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { WebView webView = new WebView(AboutActivity.this); String data = getResources().getString(R.string.open_source_librairies_licenses); webView.loadData(data, "text/html; charset=utf-8", "UTF-8"); new AlertDialog.Builder(AboutActivity.this).setView(webView).show(); } }); Element tosElement = new Element().setTitle(getString(R.string.about_read_ToS)); tosElement.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { WebView webView = new WebView(AboutActivity.this); String data = getResources().getString(R.string.QL_EULA); webView.loadData(data, "text/html; charset=utf-8", "UTF-8"); new AlertDialog.Builder(AboutActivity.this).setView(webView).show(); } }); Element cookElement = new Element().setTitle("Icon Designer"); cookElement.setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("https://cookicons.co/"))); View aboutView = new AboutPage(this).setDescription("QuickLyric is made with love in Brussels, Belgium.") // FixMe .addEmail("contact@QuickLyric.be").addFacebook("QuickLyric").addGitHub("geecko86/QuickLyric") .addPlayStore("test").addTwitter("QuickLyric").addWebsite("http://www.quicklyric.be") .setImage(R.drawable.icon).addItem(productTourElement).addItem(crowdinElement).addItem(cookElement) .addItem(ossLicensesElement).addItem(tosElement).create(); aboutView.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); linearLayout.addView(toolbar); linearLayout.addView(aboutView); setContentView(linearLayout); final Drawable upArrow; if (Build.VERSION.SDK_INT >= 21) { upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material); upArrow.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP); } else upArrow = getResources().getDrawable(R.drawable.ic_arrow_back); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeAsUpIndicator(upArrow); }
From source file:com.google.android.gcm.demo.ui.TopicsFragment.java
@Override public void refresh() { float density = getActivity().getResources().getDisplayMetrics().density; SimpleArrayMap<String, Sender> addressBook = mSenders.getSenders(); LinearLayout sendersList = new LinearLayout(getActivity()); sendersList.setOrientation(LinearLayout.VERTICAL); for (int i = 0; i < addressBook.size(); i++) { Sender sender = addressBook.valueAt(i); // Check if at least a topic is subscribed for this sender int subscribedTopics = 0; for (Boolean subscribed : sender.topics.values()) { if (subscribed) { subscribedTopics++;/*from w w w .ja v a 2 s . c o m*/ } } if (subscribedTopics > 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 senderLabel = (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); senderLabel.setText(getString(R.string.topics_sender_id, sender.senderId)); sendersList.addView(senderRow); for (Map.Entry<String, Boolean> topic : sender.topics.entrySet()) { if (topic.getValue()) { 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.bigtop_updates_grey600); label.setText(topic.getKey()); button.setText(R.string.topics_unsubscribe); button.setTag(R.id.tag_action, ACTION_UNSUBSCRIBE); button.setTag(R.id.tag_senderid, sender.senderId); button.setTag(R.id.tag_topic, topic.getKey()); button.setOnClickListener(this); row.setPadding((int) (16 * density), 0, 0, 0); sendersList.addView(row); } } } } if (sendersList.getChildCount() == 0) { TextView noTokens = new TextView(getActivity()); noTokens.setText(getString(R.string.topics_no_topic_subscribed)); noTokens.setTypeface(null, Typeface.ITALIC); sendersList.addView(noTokens); } FrameLayout topicsView = (FrameLayout) getActivity().findViewById(R.id.topics_list_wrapper); topicsView.removeAllViews(); topicsView.addView(sendersList); }
From source file:com.dwdesign.tweetings.view.TabPageIndicator.java
public TabPageIndicator(final Context context, final AttributeSet attrs) { super(context, attrs); setHorizontalScrollBarEnabled(false); mInflater = LayoutInflater.from(context); mTabLayout = new LinearLayout(getContext()); addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)); }
From source file:com.eggsoftware.flingsolver.gui.DrawSolutionPageAdapter.java
@Override public Object instantiateItem(View collection, int position) { // Create the "Step N of T" TextView TextView stepTextView = new TextView(this.context); stepTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); stepTextView.setTextColor(Color.rgb(113, 113, 113)); stepTextView.setGravity(Gravity.CENTER); stepTextView.setText(String.format(this.context.getResources().getString(R.string.step_of), position + 1, this.solution.size())); // Create the boar with the current step of the solution BoardCanvas board = new BoardCanvas(this.context); board.setBoardRepresentation(this.solution.get(position).getBoard()); board.setArrow(this.solution.get(position).getRow(), this.solution.get(position).getCol(), this.solution.get(position).getDirection()); // Add the components to the layout LinearLayout layout = new LinearLayout(this.context); layout.setOrientation(LinearLayout.VERTICAL); layout.setPadding(16, 20, 16, 16);// ww w.jav a2 s. co m RelativeLayout relativeLatout = new RelativeLayout(this.context); relativeLatout.setLayoutParams( new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f)); relativeLatout.addView(board); layout.addView(relativeLatout); layout.addView(stepTextView); ((ViewPager) collection).addView(layout, 0); return layout; }