Java Code Examples for android.widget.GridLayout#setColumnCount()
The following examples show how to use
android.widget.GridLayout#setColumnCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SortingActivity.java From Primary with GNU General Public License v3.0 | 6 votes |
@Override protected void onResume() { super.onResume(); GridLayout sortArea = findViewById(R.id.sort_area); if (isLandscape()) { numcolumns = 6; } else { numcolumns = 3; } sortArea.setColumnCount(numcolumns); //override super class LinearLayout centercol = findViewById(R.id.centercol); centercol.setOrientation(LinearLayout.VERTICAL); findViewById(R.id.score_total_correct_area).setVisibility(View.GONE); findViewById(R.id.score_level_percent_area).setVisibility(View.GONE); }
Example 2
Source File: PaymentRequestSection.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override protected void createMainSectionContent(LinearLayout mainSectionLayout) { Context context = mainSectionLayout.getContext(); // Add a label that will be used to indicate that the total cart price has been updated. addUpdateText(mainSectionLayout); // The breakdown is represented by an end-aligned GridLayout that takes up only as much // space as it needs. The GridLayout ensures a consistent margin between the columns. mBreakdownLayout = new GridLayout(context); mBreakdownLayout.setColumnCount(2); LayoutParams breakdownParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); breakdownParams.gravity = Gravity.END; mainSectionLayout.addView(mBreakdownLayout, breakdownParams); }
Example 3
Source File: ColorPreference.java From Noyze with Apache License 2.0 | 6 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); mRootView = (ViewGroup) layoutInflater.inflate(R.layout.dialog_colors, null); mAlphaSeekBar = (SeekBar) mRootView.findViewById(android.R.id.progress); mAlphaSeekBar.setOnSeekBarChangeListener(alphaSeekListener); mAlphaSeekBar.setMax(255); mAlphaSeekBar.setProgress(getValueAlpha(false)); mColorGrid = (GridLayout) mRootView.findViewById(R.id.color_grid); mColorGrid.setColumnCount(mPreference.mNumColumns); repopulateItems(); return new AlertDialog.Builder(getActivity()) .setView(mRootView) .setNegativeButton(android.R.string.cancel, clickListener) .setPositiveButton(android.R.string.ok, clickListener) .create(); }
Example 4
Source File: ColorPreference.java From Noyze with Apache License 2.0 | 6 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); mRootView = (ViewGroup) layoutInflater.inflate(R.layout.dialog_colors, null); mAlphaSeekBar = (SeekBar) mRootView.findViewById(android.R.id.progress); mAlphaSeekBar.setOnSeekBarChangeListener(alphaSeekListener); mAlphaSeekBar.setMax(255); mAlphaSeekBar.setProgress(getValueAlpha(false)); mColorGrid = (GridLayout) mRootView.findViewById(R.id.color_grid); mColorGrid.setColumnCount(mPreference.mNumColumns); repopulateItems(); return new AlertDialog.Builder(getActivity()) .setView(mRootView) .setNegativeButton(android.R.string.cancel, clickListener) .setPositiveButton(android.R.string.ok, clickListener) .create(); }
Example 5
Source File: MainActivity.java From LaunchTime with GNU General Public License v3.0 | 5 votes |
private void createIconSheet(String category, int pos) { final GridLayout iconSheet = new GridLayout(MainActivity.this); if (mIconSheet == null) mIconSheet = iconSheet; mIconSheets.put(category, iconSheet); mRevCategoryMap.put(iconSheet, category); iconSheet.setColumnCount(mColumns); iconSheet.setOnDragListener(mMainDragListener); setIconSheetLayout(iconSheet); final TextView categoryTab = createCategoryTab(category, iconSheet, pos); mCategoryTabs.put(category, categoryTab); mRevCategoryMap.put(categoryTab, category); }
Example 6
Source File: ColorPreference.java From FireFiles with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View rootView = layoutInflater.inflate(R.layout.dialog_colors, null); mColorGrid = (GridLayout) rootView.findViewById(R.id.color_grid); mColorGrid.setColumnCount(mPreference.mNumColumns); repopulateItems(); return new AlertDialog.Builder(getActivity()) .setView(rootView) .create(); }
Example 7
Source File: ColorPreference.java From FireFiles with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View rootView = layoutInflater.inflate(R.layout.dialog_colors, null); mColorGrid = (GridLayout) rootView.findViewById(R.id.color_grid); mColorGrid.setColumnCount(mPreference.mNumColumns); repopulateItems(); return new AlertDialog.Builder(getActivity()) .setView(rootView) .create(); }
Example 8
Source File: ColorPreference.java From FireFiles with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View rootView = layoutInflater.inflate(R.layout.dialog_colors, null); mColorGrid = (GridLayout) rootView.findViewById(R.id.color_grid); mColorGrid.setColumnCount(mPreference.mNumColumns); repopulateItems(); return new AlertDialog.Builder(getActivity()) .setView(rootView) .create(); }
Example 9
Source File: PaymentRequestSection.java From delion with Apache License 2.0 | 5 votes |
@Override protected void createMainSectionContent(LinearLayout mainSectionLayout) { Context context = mainSectionLayout.getContext(); // The breakdown is represented by an end-aligned GridLayout that takes up only as much // space as it needs. The GridLayout ensures a consistent margin between the columns. mBreakdownLayout = new GridLayout(context); mBreakdownLayout.setColumnCount(2); LayoutParams breakdownParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); breakdownParams.gravity = Gravity.END; mainSectionLayout.addView(mBreakdownLayout, breakdownParams); }
Example 10
Source File: PaymentRequestSection.java From delion with Apache License 2.0 | 5 votes |
@Override protected void createMainSectionContent(LinearLayout mainSectionLayout) { Context context = mainSectionLayout.getContext(); mCheckingProgress = createLoadingSpinner(); mOptionLayout = new GridLayout(context); mOptionLayout.setColumnCount(3); mainSectionLayout.addView(mOptionLayout, new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); }
Example 11
Source File: StdGameActivity.java From Primary with GNU General Public License v3.0 | 5 votes |
private void setColumnCount(GridLayout answerarea, int count) { List<View> kids = new ArrayList<>(); for(int i = 0; i< answerarea.getChildCount(); i++) { kids.add(answerarea.getChildAt(i)); } answerarea.removeAllViews(); answerarea.setColumnCount(count); for (View k: kids) { k.setLayoutParams(new GridLayout.LayoutParams()); answerarea.addView(k); } }
Example 12
Source File: ScoresActivity.java From Primary with GNU General Public License v3.0 | 5 votes |
private void showUserData(ViewGroup list, String username) { UserData user = mAppdata.getUser(username); TextView uname = new TextView(this); String avname = user.getAvatar() + " " + user.getUsername() + ": " + user.getTotalPoints(); uname.setPadding(0, 23, 0, 2); uname.setText(avname); uname.setTextSize(24); list.addView(uname); GridLayout userlayout = new GridLayout(this); //userlayout.setOrientation(GridLayout.VERTICAL); userlayout.setColumnCount(2); userlayout.setPadding(24, 8, 4, 16); list.addView(userlayout); for (String sub : user.getSubjectsStarted()) { UserData.Subject subject = user.getSubjectForUser(sub); addTextView(userlayout, sub + " (" + subjects.get(sub).getName() + "): ", 20, 0); addTextView(userlayout, subject.getTotalPoints() + ""); Map<String, Integer> thist = subject.getTodayPointHistory(); for (String day : AppData.sort(thist.keySet())) { addTextView(userlayout, day, 18, 32); addTextView(userlayout, thist.get(day) + ""); } } }
Example 13
Source File: PaymentRequestSection.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override protected void createMainSectionContent(LinearLayout mainSectionLayout) { Context context = mainSectionLayout.getContext(); mCheckingProgress = createLoadingSpinner(); mOptionLayout = new GridLayout(context); mOptionLayout.setColumnCount(4); mainSectionLayout.addView(mOptionLayout, new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); }
Example 14
Source File: TGABitmapViewerActivity.java From TGAReader with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GridLayout layout = new GridLayout(this); ScrollView scroll = new ScrollView(this); scroll.addView(layout); setContentView(scroll); try { String [] list = getAssets().list("images"); // count tga images int count = 0; for(int i=0; i<list.length; i++) { if(list[i].endsWith(".tga")) count++; } layout.setColumnCount(3); layout.setRowCount(count/3); // create tga image view for(int i=0; i<list.length; i++) { if(list[i].endsWith(".tga")) { LinearLayout view = createTGAView(list[i]); if(view != null) layout.addView(view); } } } catch (IOException e) { e.printStackTrace(); } }
Example 15
Source File: GridLayoutStyler.java From dynamico with Apache License 2.0 | 4 votes |
@Override public View style(View view, JSONObject attributes) throws Exception { super.style(view, attributes); GridLayout gridLayout = (GridLayout) view; if(attributes.has("alignmentMode")) { String mode = attributes.getString("alignmentMode"); if(mode.equalsIgnoreCase("align_bounds")) { gridLayout.setAlignmentMode(GridLayout.ALIGN_BOUNDS); }else if(mode.equalsIgnoreCase("align_margins")) { gridLayout.setAlignmentMode(GridLayout.ALIGN_MARGINS); } } if(attributes.has("orientation")) { String orientation = attributes.getString("orientation"); if(orientation.equalsIgnoreCase("vertical")) { gridLayout.setOrientation(GridLayout.VERTICAL); }else if(orientation.equalsIgnoreCase("horizontal")) { gridLayout.setOrientation(GridLayout.HORIZONTAL); } } if(attributes.has("columnCount")) { gridLayout.setColumnCount(attributes.getInt("columnCount")); } if(attributes.has("rowCount")) { gridLayout.setRowCount(attributes.getInt("rowCount")); } if(attributes.has("columnOrderPreserved")) { gridLayout.setColumnOrderPreserved(attributes.getBoolean("columnOrderPreserved")); } if(attributes.has("rowOrderPreserved")) { gridLayout.setRowOrderPreserved(attributes.getBoolean("rowOrderPreserved")); } if(attributes.has("useDefaultMargins")) { gridLayout.setUseDefaultMargins(attributes.getBoolean("useDefaultMargins")); } return gridLayout; }