Example usage for android.util TypedValue COMPLEX_UNIT_DIP

List of usage examples for android.util TypedValue COMPLEX_UNIT_DIP

Introduction

In this page you can find the example usage for android.util TypedValue COMPLEX_UNIT_DIP.

Prototype

int COMPLEX_UNIT_DIP

To view the source code for android.util TypedValue COMPLEX_UNIT_DIP.

Click Source Link

Document

#TYPE_DIMENSION complex unit: Value is Device Independent Pixels.

Usage

From source file:com.astuetz.viewpager.extensions.sample.MainActivityMenu.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_menu);

    tabs = (PagerSlidingTabStripMenu) findViewById(R.id.tabs);
    pager = (ViewPager) findViewById(R.id.pager);
    adapter = new MyPagerAdapter(getSupportFragmentManager());
    pager.setOffscreenPageLimit(2);//  w  w w  .ja  v  a  2s.c  o m
    pager.setAdapter(adapter);

    final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4,
            getResources().getDisplayMetrics());
    pager.setPageMargin(pageMargin);
    tabs.setViewPager(pager);

    changeColor(currentColor);
    initIconPostionListener();
}

From source file:com.arta.lib.demo.widget.pagerslidingtabstrip.PagerSlidingTabStripMainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.pagerslidingtabstrip_activity_main);

    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    pager = (ViewPager) findViewById(R.id.pager);
    adapter = new MyPagerAdapter(getSupportFragmentManager());

    pager.setAdapter(adapter);/* ww w.  j  av  a  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.duguang.baseanimation.ui.tab.PagerTabStrip.PagerTabMainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tab_pagertab__main);

    tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    pager = (ViewPager) findViewById(R.id.pager);
    adapter = new MyPagerAdapter(getSupportFragmentManager());

    pager.setAdapter(adapter);/*from ww w  .  jav  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.charjack.charjackplayer.MainActivity.java

@Override
public 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  va  2 s. 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.example.android.networkbasic.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Initialize text fragment that displays intro text.
    SimpleTextFragment introFragment = (SimpleTextFragment) getSupportFragmentManager()
            .findFragmentById(R.id.intro_fragment);
    introFragment.setText(R.string.intro_message);
    introFragment.getTextView().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f);

    // Initialize the logging framework.
    initializeLogging();/*from w w  w  .  j  av a2s  .  c om*/
}

From source file:com.csform.android.uiapptemplate.TabMediaActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tab_media);

    toolbar = (Toolbar) findViewById(R.id.toolbar_tab_media);
    toolbar.setTitle("Tabs media");
    setSupportActionBar(toolbar);//from w ww .  j  a v a  2 s .  co  m
    tabs = (PagerSlidingTabStrip) findViewById(R.id.activity_tab_media_tabs);
    pager = (ViewPager) findViewById(R.id.activity_tab_media_pager);

    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(0);

    tabs.setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() {
        @Override
        public void onTabReselected(int position) {
            Toast.makeText(TabMediaActivity.this, "Tab reselected: " + position, Toast.LENGTH_SHORT).show();
        }
    });
}

From source file:com.example.android.networkconnect.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sample_main);

    // Initialize text fragment that displays intro text.
    SimpleTextFragment introFragment = (SimpleTextFragment) getSupportFragmentManager()
            .findFragmentById(R.id.intro_fragment);
    introFragment.setText(R.string.welcome_message);
    introFragment.getTextView().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f);

    // Initialize the logging framework.
    initializeLogging();/*from   ww  w  .  j av  a  2  s  .co  m*/
}

From source file:com.csform.android.uiapptemplate.TabUniversalActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tab_universal);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("Tabs universal");
    setSupportActionBar(toolbar);/*from   www  .j a va 2  s.  c o  m*/
    tabs = (PagerSlidingTabStrip) findViewById(R.id.activity_tab_universal_tabs);
    pager = (ViewPager) findViewById(R.id.activity_tab_universal_pager);

    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(4);

    tabs.setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() {
        @Override
        public void onTabReselected(int position) {
            Toast.makeText(TabUniversalActivity.this, "Tab reselected: " + position, Toast.LENGTH_SHORT).show();
        }
    });
}

From source file:com.ben.mymusicplayer.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  w  w .  jav a2  s  .  co  m

    final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4,
            getResources().getDisplayMetrics());
    pager.setPageMargin(pageMargin);

    tabs.setViewPager(pager);

    changeColor(currentColor);

    app = (BenPlayerApp) getApplication();
}

From source file:com.example.android.basicnetworking.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sample_main);

    // Initialize text fragment that displays intro text.
    SimpleTextFragment introFragment = (SimpleTextFragment) getSupportFragmentManager()
            .findFragmentById(R.id.intro_fragment);
    introFragment.setText(R.string.intro_message);
    introFragment.getTextView().setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16.0f);

    // Initialize the logging framework.
    initializeLogging();//from  ww  w .  jav  a2 s.c o m

    //Initialise bug
    int bug = i;
}