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.sonnychen.aviationhk.views.VHSKFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_vhsk, container, false); RecyclerView mListView = (RecyclerView) view.findViewById(R.id.listView); cardList.clear();/*from w w w . j a va2 s . co m*/ for (Pair<String, String> cam : BaseApplication.Data.VHSKChartURLs) cardList.add(new GenericCardItem(cam.first, cam.second, cam.first)); mListView.setLayoutManager(new GridLayoutManager(getContext(), 1, LinearLayoutManager.VERTICAL, false)); mListView.setAdapter(new GenericRecyclerViewAdapter(getContext(), cardList, LinearLayout.VERTICAL)); return view; }
From source file:org.hedgewars.hedgeroid.NetRoomActivity.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); netplay = Netplay.getAppInstance(getApplicationContext()); netplay.registerRunGameListener(this); stateManager = netplay.getRoomStateManager(); stateManager.addListener(roomStateChangeListener); setContentView(R.layout.activity_netroom); startButton = (Button) findViewById(R.id.startGame); ChatFragment chatFragment = (ChatFragment) getSupportFragmentManager().findFragmentById(R.id.chatFragment); chatFragment.setInRoom(true);/*from ww w . j ava 2s.c om*/ FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.add(new NetplayStateFragment(), "netplayFragment"); trans.commit(); startButton.setVisibility(netplay.isChief() ? View.VISIBLE : View.GONE); startButton.setOnClickListener(startButtonClickListener); // Set up a tabbed UI for medium and small screens tabHost = (TabHost) findViewById(android.R.id.tabhost); if (tabHost != null) { tabHost.setup(); tabHost.getTabWidget().setOrientation(LinearLayout.VERTICAL); tabHost.addTab(tabHost.newTabSpec("map") .setIndicator(UiUtils.createVerticalTabIndicator(tabHost, R.string.room_tab_map, 0)) .setContent(R.id.mapFragment)); tabHost.addTab(tabHost.newTabSpec("settings") .setIndicator(UiUtils.createVerticalTabIndicator(tabHost, R.string.room_tab_settings, 0)) .setContent(R.id.settingsFragment)); tabHost.addTab(tabHost.newTabSpec("teams") .setIndicator(UiUtils.createVerticalTabIndicator(tabHost, R.string.room_tab_teams, 0)) .setContent(R.id.teamlistFragment)); tabHost.addTab(tabHost.newTabSpec("chat") .setIndicator(UiUtils.createVerticalTabIndicator(tabHost, R.string.room_tab_chat, 0)) .setContent(R.id.chatFragment)); tabHost.addTab(tabHost.newTabSpec("players") .setIndicator(UiUtils.createVerticalTabIndicator(tabHost, R.string.room_tab_players, 0)) .setContent(R.id.playerListContainer)); if (icicle != null) { tabHost.setCurrentTabByTag(icicle.getString("currentTab")); } } }
From source file:jlelse.simpleuisample.SampleActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // FAB//from w w w . j av a2s . c om // This way ... setFabDrawable(ContextCompat.getDrawable(this, R.mipmap.ic_launcher)); setFabListener(new View.OnClickListener() { @Override public void onClick(View v) { setDrawerEnabled(!isDrawerEnabled()); } }); setFabEnabled(true); // ... or this initFab(true, ContextCompat.getDrawable(this, R.mipmap.ic_launcher), new View.OnClickListener() { @Override public void onClick(View v) { setDrawerEnabled(!isDrawerEnabled()); } }); // Toolbar // This way ... setToolbarEnabled(true); // ... or this initToolbar(true); // Drawer // This way ... setDrawerMenuResId(R.menu.drawer); setDrawerListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem item) { new AlertDialog.Builder(SampleActivity.this).setTitle("Test").setMessage("Hey!").show(); getDrawerLayout().closeDrawers(); return true; } }); TextView headerView = new TextView(this); headerView.setText("Hi!"); setDrawerHeaderView(headerView); setDrawerEnabled(true); // ... or this initDrawer(true, R.menu.drawer, new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem item) { new AlertDialog.Builder(SampleActivity.this).setTitle("Test").setMessage("Hey!").show(); getDrawerLayout().closeDrawers(); return true; } }, headerView); NestedScrollView contentSV = new NestedScrollView(this); LinearLayout content = new LinearLayout(this); content.setOrientation(LinearLayout.VERTICAL); contentSV.addView(content); setContentView(contentSV, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); for (int i = 0; i < 100; i++) { TextView sampleTV = new TextView(this); sampleTV.setText(R.string.app_name); content.addView(sampleTV); } TextView sampleTV = new TextView(this); sampleTV.setText("Last item"); content.addView(sampleTV); }
From source file:mobisocial.musubi.objects.WebAppObj.java
@Override public View createView(Context context, ViewGroup parent) { LinearLayout frame = new LinearLayout(context); frame.setLayoutParams(CommonLayouts.FULL_WIDTH); frame.setOrientation(LinearLayout.VERTICAL); LinearLayout appBar = new LinearLayout(context); appBar.setLayoutParams(CommonLayouts.FULL_WIDTH); appBar.setOrientation(LinearLayout.HORIZONTAL); frame.addView(appBar);/*from w w w. ja v a 2 s.c o m*/ Drawable icon = context.getResources().getDrawable(R.drawable.ic_menu_globe); ImageView iv = new ImageView(context); iv.setImageDrawable(icon); iv.setAdjustViewBounds(true); iv.setMaxWidth(60); iv.setMaxHeight(60); iv.setLayoutParams(CommonLayouts.WRAPPED); appBar.addView(iv); TextView tv = new TextView(context); tv.setLayoutParams(CommonLayouts.WRAPPED); tv.setGravity(Gravity.CENTER_VERTICAL); appBar.addView(tv); LinearLayout actionBar = new LinearLayout(context); actionBar.setLayoutParams(CommonLayouts.WRAPPED); actionBar.setOrientation(LinearLayout.HORIZONTAL); frame.addView(actionBar); Button b = new Button(context); // required for listview long-press b.setLayoutParams(CommonLayouts.WRAPPED); b.setFocusable(false); b.setText("Run"); b.setOnClickListener(getRunListener()); actionBar.addView(b); b = new Button(context); // required for listview long-press b.setLayoutParams(CommonLayouts.WRAPPED); b.setFocusable(false); b.setOnClickListener(getAddListener()); actionBar.addView(b); return frame; }
From source file:com.negaheno.ui.Components.EmojiView.java
private void init() { setOrientation(LinearLayout.VERTICAL); for (int i = 0; i < Emoji.data.length; i++) { GridView gridView = new GridView(getContext()); if (AndroidUtilities.isTablet()) { gridView.setColumnWidth(AndroidUtilities.dp(60)); } else {/* w ww . j a v a2 s. c om*/ gridView.setColumnWidth(AndroidUtilities.dp(45)); } gridView.setNumColumns(-1); views.add(gridView); EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]); gridView.setAdapter(localEmojiGridAdapter); AndroidUtilities.setListViewEdgeEffectColor(gridView, 0xff999999); adapters.add(localEmojiGridAdapter); } setBackgroundColor(0xff222222); pager = new ViewPager(getContext()); pager.setAdapter(new EmojiPagesAdapter()); PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(getContext()); tabs.setViewPager(pager); tabs.setShouldExpand(true); tabs.setIndicatorColor(0xff33b5e5); tabs.setIndicatorHeight(AndroidUtilities.dp(2.0f)); tabs.setUnderlineHeight(AndroidUtilities.dp(2.0f)); tabs.setUnderlineColor(0x66000000); tabs.setTabBackground(0); LinearLayout localLinearLayout = new LinearLayout(getContext()); localLinearLayout.setOrientation(LinearLayout.HORIZONTAL); localLinearLayout.addView(tabs, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f)); ImageView localImageView = new ImageView(getContext()); localImageView.setImageResource(R.drawable.ic_emoji_backspace); localImageView.setScaleType(ImageView.ScaleType.CENTER); localImageView.setBackgroundResource(R.drawable.bg_emoji_bs); localImageView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (EmojiView.this.listener != null) { EmojiView.this.listener.onBackspace(); } } }); localLinearLayout.addView(localImageView, new LinearLayout.LayoutParams(AndroidUtilities.dp(61), LayoutParams.MATCH_PARENT)); recentsWrap = new FrameLayout(getContext()); recentsWrap.addView(views.get(0)); TextView localTextView = new TextView(getContext()); localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent)); localTextView.setTextSize(18.0f); localTextView.setTextColor(-7829368); localTextView.setGravity(17); recentsWrap.addView(localTextView); views.get(0).setEmptyView(localTextView); addView(localLinearLayout, new LinearLayout.LayoutParams(-1, AndroidUtilities.dp(48.0f))); addView(pager); loadRecents(); if (Emoji.data[0] == null || Emoji.data[0].length == 0) { pager.setCurrentItem(1); } updateColors(tabs); }
From source file:de.nico.asura.activities.WebView1.java
private void checkLogin() { // Layout for Dialog final LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); final EditText edit_name = new EditText(this); edit_name.setHint(getString(R.string.menu_Web_1_auth_fiFi)); layout.addView(edit_name);/*w ww.j a v a 2 s . c o m*/ final EditText edit_pass = new EditText(this); edit_pass.setHint(getString(R.string.menu_Web_1_auth_seFi)); edit_pass.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); layout.addView(edit_pass); final Builder builder = new Builder(this); builder.setTitle(getString(R.string.menu_Web_1_name)).setCancelable(false).setView(layout) .setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { firstField = edit_name.getText().toString(); secondField = edit_pass.getText().toString(); // Nothing? if (firstField.length() == 0 || secondField.length() == 0) { Utils.makeShortToast(WebView1.this, getString(R.string.wrong)); checkLogin(); return; } final Editor editor = prefs.edit(); editor.putString(sharedPrefFiFi, firstField); editor.putString(sharedPrefSeFi, secondField); editor.apply(); openWebView(); } }).setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { WebView1.this.finish(); } }).show(); }
From source file:de.nico.asura.activities.WebView2.java
private void checkLogin() { // Layout for Dialog final LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); final EditText edit_name = new EditText(this); edit_name.setHint(getString(R.string.menu_Web_2_auth_fiFi)); layout.addView(edit_name);//from w ww .j a va 2 s.c om final EditText edit_pass = new EditText(this); edit_pass.setHint(getString(R.string.menu_Web_2_auth_seFi)); edit_pass.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); layout.addView(edit_pass); final Builder builder = new Builder(this); builder.setTitle(getString(R.string.menu_Web_2_name)).setCancelable(false).setView(layout) .setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { firstField = edit_name.getText().toString(); secondField = edit_pass.getText().toString(); // Nothing? if (firstField.length() == 0 || secondField.length() == 0) { Utils.makeShortToast(WebView2.this, getString(R.string.wrong)); checkLogin(); return; } final Editor editor = prefs.edit(); editor.putString(sharedPrefFiFi, firstField); editor.putString(sharedPrefSeFi, secondField); editor.apply(); openWebView(); } }).setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { WebView2.this.finish(); } }).show(); }
From source file:de.nico.asura.activities.WebView3.java
private void checkLogin() { // Layout for Dialog final LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); final EditText edit_name = new EditText(this); edit_name.setHint(getString(R.string.menu_Web_3_auth_fiFi)); layout.addView(edit_name);//ww w . j a va 2 s . c o m final EditText edit_pass = new EditText(this); edit_pass.setHint(getString(R.string.menu_Web_3_auth_seFi)); edit_pass.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); layout.addView(edit_pass); final Builder builder = new Builder(this); builder.setTitle(getString(R.string.menu_Web_3_name)).setCancelable(false).setView(layout) .setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { firstField = edit_name.getText().toString(); secondField = edit_pass.getText().toString(); // Nothing? if (firstField.length() == 0 || secondField.length() == 0) { Utils.makeShortToast(WebView3.this, getString(R.string.wrong)); checkLogin(); return; } final Editor editor = prefs.edit(); editor.putString(sharedPrefFiFi, firstField); editor.putString(sharedPrefSeFi, secondField); editor.apply(); openWebView(); } }).setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { WebView3.this.finish(); } }).show(); }
From source file:com.yahala.ui.Views.EmojiView.java
private void init() { setOrientation(LinearLayout.VERTICAL); for (int i = 0; i < Emoji.data.length; i++) { GridView gridView = new GridView(getContext()); gridView.setColumnWidth(OSUtilities.dpf(45.0f)); gridView.setNumColumns(-1);//from ww w. j a va 2s .c om views.add(gridView); EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]); gridView.setAdapter(localEmojiGridAdapter); adapters.add(localEmojiGridAdapter); } setBackgroundDrawable( new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[] { -14145496, -16777216 })); pager = new ViewPager(getContext()); pager.setAdapter(new EmojiPagesAdapter()); PagerSlidingTabStripEmoji tabs = new PagerSlidingTabStripEmoji(getContext()); tabs.setViewPager(pager); tabs.setShouldExpand(true); tabs.setIndicatorColor(0xff33b5e5); tabs.setIndicatorHeight(OSUtilities.dpf(2.0f)); tabs.setUnderlineHeight(OSUtilities.dpf(2.0f)); tabs.setUnderlineColor(1711276032); tabs.setTabBackground(0); LinearLayout localLinearLayout = new LinearLayout(getContext()); localLinearLayout.setOrientation(LinearLayout.HORIZONTAL); localLinearLayout.addView(tabs, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f)); ImageView localImageView = new ImageView(getContext()); localImageView.setImageResource(R.drawable.ic_emoji_backspace); localImageView.setScaleType(ImageView.ScaleType.CENTER_CROP); localImageView.setBackgroundResource(R.drawable.bg_emoji_bs); localImageView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (EmojiView.this.listener != null) { EmojiView.this.listener.onBackspace(); } } }); localLinearLayout.addView(localImageView, new LinearLayout.LayoutParams(OSUtilities.dpf(61.0f), LayoutParams.MATCH_PARENT)); recentsWrap = new FrameLayout(getContext()); recentsWrap.addView(views.get(0)); TextView localTextView = new TextView(getContext()); localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent)); localTextView.setTextSize(18.0f); localTextView.setTextColor(-7829368); localTextView.setGravity(17); recentsWrap.addView(localTextView); views.get(0).setEmptyView(localTextView); addView(localLinearLayout, new LinearLayout.LayoutParams(-1, OSUtilities.dpf(48.0f))); addView(pager); loadRecents(); if (Emoji.data[0] == null || Emoji.data[0].length == 0) { pager.setCurrentItem(1); } }
From source file:me.cpwc.nibblegram.ui.Components.EmojiView.java
private void init() { setOrientation(LinearLayout.VERTICAL); for (int i = 0; i < Emoji.data.length; i++) { GridView gridView = new GridView(getContext()); if (AndroidUtilities.isTablet()) { gridView.setColumnWidth(AndroidUtilities.dp(60)); } else {/*w w w .ja v a 2 s . c om*/ gridView.setColumnWidth(AndroidUtilities.dp(45)); } gridView.setNumColumns(-1); views.add(gridView); EmojiGridAdapter localEmojiGridAdapter = new EmojiGridAdapter(Emoji.data[i]); gridView.setAdapter(localEmojiGridAdapter); AndroidUtilities.setListViewEdgeEffectColor(gridView, 0xff999999); adapters.add(localEmojiGridAdapter); } setBackgroundColor(0xff222222); pager = new ViewPager(getContext()); pager.setAdapter(new EmojiPagesAdapter()); PagerSlidingTabStrip tabs = new PagerSlidingTabStrip(getContext()); tabs.setViewPager(pager); tabs.setShouldExpand(true); tabs.setIndicatorColor(0xff33b5e5); tabs.setIndicatorHeight(AndroidUtilities.dp(2.0f)); tabs.setUnderlineHeight(AndroidUtilities.dp(2.0f)); tabs.setUnderlineColor(0x66000000); tabs.setTabBackground(0); LinearLayout localLinearLayout = new LinearLayout(getContext()); localLinearLayout.setOrientation(LinearLayout.HORIZONTAL); localLinearLayout.addView(tabs, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1.0f)); ImageView localImageView = new ImageView(getContext()); localImageView.setImageResource(R.drawable.ic_emoji_backspace); localImageView.setScaleType(ImageView.ScaleType.CENTER); localImageView.setBackgroundResource(R.drawable.bg_emoji_bs); localImageView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { if (EmojiView.this.listener != null) { EmojiView.this.listener.onBackspace(); } } }); localLinearLayout.addView(localImageView, new LinearLayout.LayoutParams(AndroidUtilities.dp(61), LayoutParams.MATCH_PARENT)); recentsWrap = new FrameLayout(getContext()); recentsWrap.addView(views.get(0)); TextView localTextView = new TextView(getContext()); localTextView.setText(LocaleController.getString("NoRecent", R.string.NoRecent)); localTextView.setTextSize(18.0f); localTextView.setTextColor(-7829368); localTextView.setGravity(17); recentsWrap.addView(localTextView); views.get(0).setEmptyView(localTextView); addView(localLinearLayout, new LinearLayout.LayoutParams(-1, AndroidUtilities.dp(48.0f))); addView(pager); loadRecents(); if (Emoji.data[0] == null || Emoji.data[0].length == 0) { pager.setCurrentItem(1); } }