List of usage examples for android.content.res TypedArray getLayoutDimension
public int getLayoutDimension(@StyleableRes int index, int defValue)
From source file:Main.java
public static void fetchWidthAndHeight(LayoutParams params, TypedArray array, int widthAttr, int heightAttr) { params.width = array.getLayoutDimension(widthAttr, 0); params.height = array.getLayoutDimension(heightAttr, 0); }
From source file:Main.java
public static void fetchWidthAndHeight(android.view.ViewGroup.LayoutParams params, TypedArray array, int widthAttr, int heightAttr) { params.width = array.getLayoutDimension(widthAttr, 0); params.height = array.getLayoutDimension(heightAttr, 0); }
From source file:Main.java
/** * Helper method to be called from {@link ViewGroup.LayoutParams#setBaseAttributes} override * that reads layout_width and layout_height attribute values without throwing an exception if * they aren't present.//w ww .ja va 2s .c o m */ public static void fetchWidthAndHeight(ViewGroup.LayoutParams params, TypedArray array, int widthAttr, int heightAttr) { params.width = array.getLayoutDimension(widthAttr, 0); params.height = array.getLayoutDimension(heightAttr, 0); }
From source file:Main.java
/** * Helper method to be called from/*from www . j a v a2 s .c o m*/ * {@link ViewGroup.LayoutParams#setBaseAttributes} override that reads * layout_width and layout_height attribute values without throwing an * exception if they aren't present. */ @SuppressLint("NewApi") public static void fetchWidthAndHeight(ViewGroup.LayoutParams params, TypedArray array, int widthAttr, int heightAttr) { params.width = array.getLayoutDimension(widthAttr, 0); params.height = array.getLayoutDimension(heightAttr, 0); }
From source file:com.actionbarsherlock.sample.demos.app.ActionBarActionItemCustomView.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem item = menu.add(0, android.R.id.copy, 0, "Test"); final int twentyDp = (int) (20 * getResources().getDisplayMetrics().density); TypedArray a = getTheme().obtainStyledAttributes(R.styleable.SherlockTheme); final int abHeight = a.getLayoutDimension(R.styleable.SherlockTheme_abHeight, LayoutParams.FILL_PARENT); a.recycle();/*from w w w . j a v a 2 s .c om*/ LinearLayout l = new LinearLayout(this); l.setPadding(twentyDp, 0, twentyDp, 20); l.setBackgroundColor(0x55FF0000); TextView tv = new TextView(this); tv.setText("HI!!"); tv.setGravity(Gravity.CENTER); tv.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, abHeight)); l.addView(tv); l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(ActionBarActionItemCustomView.this, "Got custom action item click!", Toast.LENGTH_SHORT).show(); } }); item.setActionView(l); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return super.onCreateOptionsMenu(menu); }
From source file:android.support.v7.internal.view.ActionBarPolicy.java
public int getTabContainerHeight() { TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0); int height = a.getLayoutDimension(R.styleable.ActionBar_height, 0); Resources r = mContext.getResources(); if (!hasEmbeddedTabs()) { // Stacked tabs; limit the height height = Math.min(height, r.getDimensionPixelSize(R.dimen.abc_action_bar_stacked_max_height)); }/*from w ww.j a va2 s. c o m*/ a.recycle(); return height; }
From source file:android.support.v7ox.view.ActionBarPolicy.java
public int getTabContainerHeight() { TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle_ox, 0); int height = a.getLayoutDimension(R.styleable.ActionBar_height, 0); Resources r = mContext.getResources(); if (!hasEmbeddedTabs()) { // Stacked tabs; limit the height height = Math.min(height, r.getDimensionPixelSize(R.dimen.abc_action_bar_stacked_max_height)); }/*from ww w . j a va 2 s. co m*/ a.recycle(); return height; }
From source file:android.support.v7.internal.widget.AbsActionBarView.java
@Override protected void onConfigurationChanged(Configuration newConfig) { if (Build.VERSION.SDK_INT >= 8) { super.onConfigurationChanged(newConfig); }//from w w w . j ava 2s. c o m // Action bar can change size on configuration changes. // Reread the desired height from the theme-specified style. TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0); setContentHeight(a.getLayoutDimension(R.styleable.ActionBar_height, 0)); a.recycle(); if (mActionMenuPresenter != null) { mActionMenuPresenter.onConfigurationChanged(newConfig); } }
From source file:android.support.v7ox.widget.AbsActionBarView.java
@Override protected void onConfigurationChanged(Configuration newConfig) { if (Build.VERSION.SDK_INT >= 8) { super.onConfigurationChanged(newConfig); }// ww w . j a v a2 s . com // Action bar can change size on configuration changes. // Reread the desired height from the theme-specified style. TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle_ox, 0); setContentHeight(a.getLayoutDimension(R.styleable.ActionBar_height, 0)); a.recycle(); if (mActionMenuPresenter != null) { mActionMenuPresenter.onConfigurationChanged(newConfig); } }
From source file:com.actionbarsherlock.internal.widget.AbsActionBarView.java
@Override public void onConfigurationChanged(Configuration newConfig) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { super.onConfigurationChanged(newConfig); } else if (mMenuView != null) { mMenuView.onConfigurationChanged(newConfig); }//from w ww .ja v a 2s .c o m // Action bar can change size on configuration changes. // Reread the desired height from the theme-specified style. TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.SherlockActionBar, R.attr.actionBarStyle, 0); setContentHeight(a.getLayoutDimension(R.styleable.SherlockActionBar_height, 0)); a.recycle(); if (mSplitWhenNarrow) { setSplitActionBar(getResources_getBoolean(getContext(), R.bool.abs__split_action_bar_is_narrow)); } if (mActionMenuPresenter != null) { mActionMenuPresenter.onConfigurationChanged(newConfig); } }