List of usage examples for android.util TypedValue COMPLEX_UNIT_DIP
int COMPLEX_UNIT_DIP
To view the source code for android.util TypedValue COMPLEX_UNIT_DIP.
Click Source Link
From source file:com.achillesrasquinha.biblegenerator.ImageGenerator.java
public ImageGenerator(Context context) { mContext = context;/*from w w w . j a v a2 s .co m*/ DisplayMetrics m = mContext.getResources().getDisplayMetrics(); mImageSize = new Point(); mImageSize.x = m.widthPixels; mImageSize.y = mImageSize.x; mX = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, m)); mSizeTitle = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 24, m); mYTitle = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, m) + mSizeTitle); mSizeSubtitle = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 14, m); mYSubtitle = Math .round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, m) + mYTitle + mSizeSubtitle); mLineSpacing = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, m); mTextPaint = new TextPaint(); mTextPaint.setAntiAlias(true); mTextPaint.setTextAlign(TextPaint.Align.LEFT); mTextPaint.setTypeface(Typeface.createFromAsset(mContext.getAssets(), "fonts/Roboto/Roboto-Medium.ttf")); mColor1 = ContextCompat.getColor(mContext, R.color.primary_text_default_material_light); mColor2 = ContextCompat.getColor(mContext, R.color.primary_text_disabled_material_light); mColor3 = ContextCompat.getColor(mContext, R.color.secondary_text_default_material_light); }
From source file:com.connectsdk.smarthomesampler.dialog.AcknowledgementsFragmentDialog.java
@NonNull @Override//from w w w . ja va 2 s .com public Dialog onCreateDialog(Bundle savedInstanceState) { Context context = getActivity(); final TextView message = new TextView(context); message.setText(Html.fromHtml(context.getString(R.string.info_message))); message.setMovementMethod(LinkMovementMethod.getInstance()); int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 25, context.getResources().getDisplayMetrics()); message.setPadding(padding, 0, padding, 0); ScrollView scrollView = new ScrollView(context); scrollView.addView(message); return new AlertDialog.Builder(context).setTitle(R.string.info_title).setView(scrollView) .setCancelable(true).create(); }
From source file:am.project.x.business.widgets.tagtabstrip.TagTabStripActivity.java
private ArrayList<View> getPagers() { ArrayList<View> views = new ArrayList<>(); for (int i = 0; i < 5; i++) { TextView text = new TextView(this); text.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 180); text.setText(String.format(Locale.getDefault(), "%d", i + 1)); text.setGravity(Gravity.CENTER); text.setTextColor(0xff000000);/*from w w w.j av a 2s . c om*/ views.add(text); } return views; }
From source file:com.example.mac.myapplication.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/*from ww w.j a v a 2 s. c om*/ final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.example.fazazi.muslimprayer.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/* w w w. j a v a 2 s. co m*/ final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setText("Page " + (position + 1)); fl.addView(v); return fl; }
From source file:cn.yunt.www.pagerslidingtabstrip.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);//from w w w .j a v a2s . co m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.normsstuff.maps4norm.Util.java
/** * Converts the given lenght in dp into pixels * * @param c the Context// ww w. j a v a 2 s.com * @param dp the size in dp * @return the size in px */ static int dpToPx(final Context c, int dp) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, c.getResources().getDisplayMetrics()); }
From source file:com.codewarrior.mobiocontact.fragments.DialerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/*from w w w. j a va 2s. c o m*/ final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD 44"); fl.addView(v); return fl; }
From source file:com.codewarrior.mobiocontact.fragments.RecentFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);// w w w . j a v a 2 s.c o m final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD 22"); fl.addView(v); return fl; }
From source file:com.ageelg.android.testviewpagerwslider.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); //fl.setLayoutParams(params); final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); //params.setMargins(margin, margin, margin, margin); //v.setLayoutParams(params); //v.setLayoutParams(params); v.setGravity(Gravity.CENTER);// w ww .j a va2 s .c o m v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }