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.example.toolbar.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);/* www . jav a 2 s . c o m*/ 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.eggsoftware.flingsolver.gui.DrawSolutionPageAdapter.java
@Override public Object instantiateItem(View collection, int position) { // Create the "Step N of T" TextView TextView stepTextView = new TextView(this.context); stepTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); stepTextView.setTextColor(Color.rgb(113, 113, 113)); stepTextView.setGravity(Gravity.CENTER); stepTextView.setText(String.format(this.context.getResources().getString(R.string.step_of), position + 1, this.solution.size())); // Create the boar with the current step of the solution BoardCanvas board = new BoardCanvas(this.context); board.setBoardRepresentation(this.solution.get(position).getBoard()); board.setArrow(this.solution.get(position).getRow(), this.solution.get(position).getCol(), this.solution.get(position).getDirection()); // Add the components to the layout LinearLayout layout = new LinearLayout(this.context); layout.setOrientation(LinearLayout.VERTICAL); layout.setPadding(16, 20, 16, 16);//w w w .ja v a2 s.c o m RelativeLayout relativeLatout = new RelativeLayout(this.context); relativeLatout.setLayoutParams( new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f)); relativeLatout.addView(board); layout.addView(relativeLatout); layout.addView(stepTextView); ((ViewPager) collection).addView(layout, 0); return layout; }
From source file:beihua.example.com.kouding_app.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);/* w w w. j ava 2s.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.asc_ii.bangnote.bigbang.BigBangActionBar.java
private void initSubViews() { Context context = getContext(); mBorder = ContextCompat.getDrawable(context, R.drawable.bigbang_action_bar_bg); mBorder.setCallback(this); mSearch = new ImageView(context); mSearch.setImageResource(R.mipmap.bigbang_action_search); mSearch.setOnClickListener(this); mShare = new ImageView(context); mShare.setImageResource(R.mipmap.bigbang_action_share); mShare.setOnClickListener(this); mCopy = new ImageView(context); mCopy.setImageResource(R.mipmap.bigbang_action_copy); mCopy.setOnClickListener(this); addView(mSearch, createLayoutParams()); addView(mShare, createLayoutParams()); addView(mCopy, createLayoutParams()); setWillNotDraw(false);//from w w w .ja va 2 s.c o m mActionGap = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, getResources().getDisplayMetrics()); mContentPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics()); }
From source file:com.csform.android.uiapptemplate.TabTravelActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tab_travel); tabs = (PagerSlidingTabStrip) findViewById(R.id.activity_tab_travel_tabs); pager = (ViewPager) findViewById(R.id.activity_tab_travel_pager); image = (ImageView) findViewById(R.id.activity_tab_travel_image); ImageUtil.displayImage(image,/* w w w . j a v a2 s. com*/ "http://pengaja.com/uiapptemplate/newphotos/listviews/swipetodissmiss/travel/1.jpg", null); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter); tabs.setViewPager(pager); final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); pager.setCurrentItem(3); tabs.setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() { @Override public void onTabReselected(int position) { Toast.makeText(TabTravelActivity.this, "Tab reselected: " + position, Toast.LENGTH_SHORT).show(); } }); }
From source file:com.chale22.ico01.ThemeActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mShareIntent = new Intent(); mShareIntent.setAction(Intent.ACTION_SEND); mShareIntent.setType("text/plain"); mShareIntent.putExtra(Intent.EXTRA_TEXT, "From me to you, this text is new."); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); ViewPager pager = (ViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter);// w w w . 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.statelayout.StateLayoutActivity.java
@Override protected void initializeActivity(@Nullable Bundle savedInstanceState) { setSupportActionBar(R.id.sl_toolbar); mVState = findViewById(R.id.sl_lyt_state); final RadioGroup state = findViewById(R.id.sl_rg_state); final RadioGroup mode = findViewById(R.id.sl_rg_mode); mDLoading = ContextCompat.getDrawable(this, R.drawable.ic_statelayout_loading); mDError = ContextCompat.getDrawable(this, R.drawable.ic_statelayout_error); mDEmpty = ContextCompat.getDrawable(this, R.drawable.ic_statelayout_empty); final AppCompatTextView loading = new AppCompatTextView(this); loading.setText(R.string.sl_change_state_loading); loading.setTextColor(0xfff2f71c);//from w w w . jav a2s . c o m loading.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 64); mVLoading = loading; final AppCompatTextView error = new AppCompatTextView(this); error.setText(R.string.sl_change_state_error); error.setTextColor(0xffff4081); error.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 64); mVError = error; final AppCompatTextView empty = new AppCompatTextView(this); empty.setText(R.string.sl_change_state_empty); empty.setTextColor(0xff092d6d); empty.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 64); mVEmpty = empty; mVState.setOnStateClickListener(this); state.setOnCheckedChangeListener(this); state.check(R.id.sl_rb_normal); mode.setOnCheckedChangeListener(this); mode.check(R.id.sl_rb_drawable); }
From source file:com.eccyan.widget.sample.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.inject(this); setSupportActionBar(toolbar);//from w ww. j ava 2s. c om // create our manager instance after the content view is set mTintManager = new SystemBarTintManager(this); // enable status bar tint mTintManager.setStatusBarTintEnabled(true); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter); tabs.setViewPager(pager); final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); changeColor(getResources().getColor(R.color.green)); tabs.setOnTabReselectedListener(new SpinningTabStrip.OnTabReselectedListener() { @Override public void onTabReselected(int position) { Toast.makeText(MainActivity.this, "Tab reselected: " + position, Toast.LENGTH_SHORT).show(); } }); }
From source file:com.evilduck.animtest.DraggedPanelLayout.java
public DraggedPanelLayout(Context context) { super(context); bottomPanelPeekHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics()); parallaxFactor = PARALLAX_FACTOR;//from www . j av a 2 s .c om if (!isInEditMode()) { shadowDrawable = getResources().getDrawable(R.drawable.shadow_np); willDrawShadow = true; } touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); }
From source file:com.aujur.ebookreader.reading.options.ReadingOptionsFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); adapter = new MyPagerAdapter(getActivity().getSupportFragmentManager()); pager.setAdapter(adapter);// w ww. j a v a2 s . com final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); pager.setPageMarginDrawable(R.color.medium_gray); tabs.setViewPager(pager); changeColor(currentColor); }