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.collcloud.frame.viewpager.main.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. ja 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.tab_pagertab_background_card); v.setText("CARD is " + (position + 1)); fl.addView(v); return fl; }
From source file:com.aaagame.proframework.fragment.T_PaletteFragment.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);// www .j a v a 2 s . c om fl.setBackgroundResource(drawables[position]); 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.BOTTOM); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.eric.quora.fragment.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 . ja v a 2 s. co m*/ fl.setBackgroundResource(mipmaps[position]); 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.BOTTOM); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.aero.control.helpers.Android.CirclePageIndicator.java
private static int dpToPx(float dp, Resources resources) { float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics()); return (int) px; }
From source file:cn.psvmc.demo.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabs = (ZJSlidingTab) findViewById(R.id.tabs); pager = (ZJTabViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); //pager?//from w w w. j a v a 2 s.c om pager.setCanScroll(true); pager.setAdapter(adapter); final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); tabs.setViewPager(pager); //? tabs.setIndicatorHeight(6); changeColor(currentColor); tabs.setSelectItem(2); }
From source file:com.arman.efficientqhalgoforch.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager = (ViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter);//from w ww .j a v a 2 s . com final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); tabs.setViewPager(pager); changeColor(currentColor); }
From source file:cn.yunt.www.pagerslidingtabstrip.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager = (ViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter);/*from ww w . j a v a 2 s . co m*/ final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); tabs.setViewPager(pager); // changeColor(currentColor); }
From source file:com.example.demo.frame.pageslidingtabstrip.PagerSlidingTabStripActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test_activity_sliding_tab_strip_main); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager = (ViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter);/*from w w w. j a va2s . c om*/ final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); tabs.setViewPager(pager); changeColor(currentColor); }
From source file:com.carinsurance.pagerslidingtabstrip.pagerslidingtabstripMainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pagerslidingtabstriptest); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager = (ViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter);//from w ww. j a va2 s .c o m final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); tabs.setViewPager(pager); }
From source file:am.project.x.business.widgets.gradienttabstrip.GradientTabStripActivity.java
private ArrayList<View> getPagers() { ArrayList<View> views = new ArrayList<>(); for (int i = 0; i < 4; 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 www .jav a2s. co m views.add(text); } return views; }