Java Code Examples for android.view.ViewGroup#setPaddingRelative()
The following examples show how to use
android.view.ViewGroup#setPaddingRelative() .
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: BasePreferenceFragmentCompat.java From Focus with GNU General Public License v3.0 | 5 votes |
private void setZeroPaddingToLayoutChildren(View view) { if (!(view instanceof ViewGroup)) return; ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { setZeroPaddingToLayoutChildren(viewGroup.getChildAt(i)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) viewGroup.setPaddingRelative(0, viewGroup.getPaddingTop(), viewGroup.getPaddingEnd(), viewGroup.getPaddingBottom()); else viewGroup.setPadding(0, viewGroup.getPaddingTop(), viewGroup.getPaddingRight(), viewGroup.getPaddingBottom()); } }
Example 2
Source File: BasePreferenceFragmentCompat.java From Focus with GNU General Public License v3.0 | 5 votes |
private void setZeroPaddingToLayoutChildren(View view) { if (!(view instanceof ViewGroup)) return; ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { setZeroPaddingToLayoutChildren(viewGroup.getChildAt(i)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) viewGroup.setPaddingRelative(0, viewGroup.getPaddingTop(), viewGroup.getPaddingEnd(), viewGroup.getPaddingBottom()); else viewGroup.setPadding(0, viewGroup.getPaddingTop(), viewGroup.getPaddingRight(), viewGroup.getPaddingBottom()); } }
Example 3
Source File: AndroidBarUtils.java From AndroidBarUtils with Apache License 2.0 | 5 votes |
/** * 创建Navigation Bar * * @param activity 上下文 */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) private static void createNavBar(Activity activity) { int navBarHeight = getNavigationBarHeight(activity); int navBarWidth = getNavigationBarWidth(activity); if (navBarHeight > 0 && navBarWidth > 0) { //创建NavigationBar View navBar = new View(activity); FrameLayout.LayoutParams pl; if (activity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { pl = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, navBarHeight); pl.gravity = Gravity.BOTTOM; } else { pl = new FrameLayout.LayoutParams(navBarWidth, ViewGroup.LayoutParams.MATCH_PARENT); pl.gravity = Gravity.END; } navBar.setLayoutParams(pl); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { navBar.setBackgroundColor(Color.parseColor("#fffafafa")); } else { navBar.setBackgroundColor(Color.parseColor("#40000000")); } //添加到布局当中 ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); decorView.addView(navBar); //设置主布局PaddingBottom ViewGroup contentView = decorView.findViewById(android.R.id.content); if (activity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { contentView.setPaddingRelative(0, 0, 0, navBarHeight); } else { contentView.setPaddingRelative(0, 0, navBarWidth, 0); } } }
Example 4
Source File: BasePreferenceFragmentCompat.java From GotoSleep with GNU General Public License v3.0 | 5 votes |
private void setZeroPaddingToLayoutChildren(View view) { if (!(view instanceof ViewGroup)) return; ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { setZeroPaddingToLayoutChildren(viewGroup.getChildAt(i)); viewGroup.setPaddingRelative(0, viewGroup.getPaddingTop(), viewGroup.getPaddingEnd(), viewGroup.getPaddingBottom()); } }
Example 5
Source File: SettingsFragment.java From sleep-cycle-alarm with GNU General Public License v3.0 | 5 votes |
private void setZeroPaddingToLayoutChildren(View view) { if (!(view instanceof ViewGroup)) return; ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { setZeroPaddingToLayoutChildren(viewGroup.getChildAt(i)); viewGroup.setPaddingRelative(0, viewGroup.getPaddingTop(), viewGroup.getPaddingEnd(), viewGroup.getPaddingBottom()); } }
Example 6
Source File: SettingsFragment.java From SmartPack-Kernel-Manager with GNU General Public License v3.0 | 5 votes |
private void setZeroPaddingToLayoutChildren(View view) { if (!(view instanceof ViewGroup)) return; ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { setZeroPaddingToLayoutChildren(viewGroup.getChildAt(i)); viewGroup.setPaddingRelative(0, viewGroup.getPaddingTop(), viewGroup.getPaddingEnd(), viewGroup.getPaddingBottom()); } }
Example 7
Source File: SettingsFragment.java From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 | 5 votes |
private void setZeroPaddingToLayoutChildren(View view) { if (!(view instanceof ViewGroup)) return; ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { setZeroPaddingToLayoutChildren(viewGroup.getChildAt(i)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) viewGroup.setPaddingRelative(0, viewGroup.getPaddingTop(), viewGroup.getPaddingEnd(), viewGroup.getPaddingBottom()); else viewGroup.setPadding(0, viewGroup.getPaddingTop(), viewGroup.getPaddingRight(), viewGroup.getPaddingBottom()); } }
Example 8
Source File: BasePreferenceFragment.java From ColorPicker with Apache License 2.0 | 5 votes |
private void setZeroPaddingToLayoutChildren(View view) { if (!(view instanceof ViewGroup)) return; ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { setZeroPaddingToLayoutChildren(viewGroup.getChildAt(i)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { viewGroup.setPaddingRelative(0, viewGroup.getPaddingTop(), viewGroup.getPaddingEnd(), viewGroup.getPaddingBottom()); } else { viewGroup.setPadding(0, viewGroup.getPaddingTop(), viewGroup.getPaddingRight(), viewGroup.getPaddingBottom()); } } }
Example 9
Source File: NGPreferenceFragment.java From android_maplibui with GNU Lesser General Public License v3.0 | 5 votes |
private void setZeroPaddingToLayoutChildren(View view) { if (!(view instanceof ViewGroup)) return; ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { setZeroPaddingToLayoutChildren(viewGroup.getChildAt(i)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) viewGroup.setPaddingRelative(0, viewGroup.getPaddingTop(), viewGroup.getPaddingEnd(), viewGroup.getPaddingBottom()); else viewGroup.setPadding(0, viewGroup.getPaddingTop(), viewGroup.getPaddingRight(), viewGroup.getPaddingBottom()); } }