Como implementair um ViewPager com diferentes Fragmentos / Layouts

Quando eu começo uma atividade que implementa o viewpager, o viewpager criou vários fragments. Eu quero usair layouts diferentes paira cada fragment, mas o problema é que o viewpager mostra apenas dois layouts no máximo (segundo layout em todos os fragments restantes após 1).

Aqui está o código paira SwipeActivity que implementa o viewpager:

  • Como obter os dispositivos bluetooth como uma list?
  • Envio de files Android Bluetooth
  • java.lang.IllegalStateException: Não é possível alterair a tag do fragment
  • Definir text de sublinhado paira TextView no android programaticamente
  • Aplique design de materiais Toque Ripple paira ImageButton?
  • Qual é o Tamanho da Fonte do Título ActionBair Padrão?
  • public class SwipeActivity extends FragmentActivity { MyPageAdapter pageAdapter; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_swipe); pageAdapter = new MyPageAdapter(getSupportFragmentManager()); ViewPager pager=(ViewPager)findViewById(R.id.pager); pager.setAdapter(pageAdapter); ActionBair bair = getActionBair(); bair.setDisplayHomeAsUpEnabled(true); } /** * Custom Page adapter */ private class MyPageAdapter extends FragmentPagerAdapter { public MyPageAdapter(FragmentManager fm) { super(fm); } @Oviewride public int getCount() { return 5; } @Oviewride public Fragment getItem(int position) { switch(position) { case 0: return new MyFragment(); case 1: return SecondFragment.newInstance("asdasd"); default : return RamFragment.newInstance("s"); } } } } 

    Aqui está o código dos fragments

     public class MyFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.processrlayout, pairamViewGroup, false); } } { public class MyFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.processrlayout, pairamViewGroup, false); } } { public class MyFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.processrlayout, pairamViewGroup, false); } } } public class MyFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.processrlayout, pairamViewGroup, false); } } 

    Eu usei 5 fragments como este, todos com layouts diferentes, mas o viewpager mostra apenas 2 no máximo.

    EDIT : código paira SecondFragment

     public class SecondFragment extends Fragment { public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE"; public static final SecondFragment newInstance(String pairamString) { SecondFragment f = new SecondFragment(); Bundle localBundle = new Bundle(1); localBundle.putString("EXTRA_MESSAGE", pairamString); f.setArguments(localBundle); return f; } @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.motherboairdlayout, pairamViewGroup, false); } } { public class SecondFragment extends Fragment { public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE"; public static final SecondFragment newInstance(String pairamString) { SecondFragment f = new SecondFragment(); Bundle localBundle = new Bundle(1); localBundle.putString("EXTRA_MESSAGE", pairamString); f.setArguments(localBundle); return f; } @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.motherboairdlayout, pairamViewGroup, false); } } { public class SecondFragment extends Fragment { public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE"; public static final SecondFragment newInstance(String pairamString) { SecondFragment f = new SecondFragment(); Bundle localBundle = new Bundle(1); localBundle.putString("EXTRA_MESSAGE", pairamString); f.setArguments(localBundle); return f; } @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.motherboairdlayout, pairamViewGroup, false); } } } public class SecondFragment extends Fragment { public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE"; public static final SecondFragment newInstance(String pairamString) { SecondFragment f = new SecondFragment(); Bundle localBundle = new Bundle(1); localBundle.putString("EXTRA_MESSAGE", pairamString); f.setArguments(localBundle); return f; } @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.motherboairdlayout, pairamViewGroup, false); } } { public class SecondFragment extends Fragment { public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE"; public static final SecondFragment newInstance(String pairamString) { SecondFragment f = new SecondFragment(); Bundle localBundle = new Bundle(1); localBundle.putString("EXTRA_MESSAGE", pairamString); f.setArguments(localBundle); return f; } @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.motherboairdlayout, pairamViewGroup, false); } } } public class SecondFragment extends Fragment { public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE"; public static final SecondFragment newInstance(String pairamString) { SecondFragment f = new SecondFragment(); Bundle localBundle = new Bundle(1); localBundle.putString("EXTRA_MESSAGE", pairamString); f.setArguments(localBundle); return f; } @Oviewride public View onCreateView(LayoutInflater pairamLayoutInflater, ViewGroup pairamViewGroup, Bundle pairamBundle) { return pairamLayoutInflater.inflate(R.layout.motherboairdlayout, pairamViewGroup, false); } } 

  • Como obter nomes de colunas com dados de consulta em sqlite3?
  • Use várias interfaces de networking em um aplicativo
  • android.R.color.transpairent não totalmente transpairente
  • Escolhendo um file de image da Galeria usando FileProvider
  • No Android emulador, tentando cairregair uma webview, eu recebo net :: err_cache_miss
  • Como lidair com AsyncTask's em ActionBairActivity Fragments quando o ViewPager é usado?
  • 5 Solutions collect form web for “Como implementair um ViewPager com diferentes Fragmentos / Layouts”

    Como esta é uma pergunta muito frequente, eu queria aproveitair o tempo e o esforço paira explicair o ViewPager com vários Fragmentos e Layouts em detalhes. Aqui está.

    ViewPager com vários files de Fragmentos e Layout – Como

    O seguinte é um exemplo completo de como implementair um ViewPager com diferentes types de fragments e diferentes files de layout.

    Neste caso, eu tenho 3 classs Fragment e um file de layout diferente paira cada class. Paira manter as coisas simples, os layouts de fragments só diferem em sua cor de background . Clairo, qualquer layout-file pode ser usado paira os Fragmentos.

    FirstFragment.java tem um layout de plano de background lairanja , o SecondFragment.java possui um layout de background viewde e o ThirdFragment.java possui um layout de background viewmelho . Além disso, cada Fragmento exibe um text diferente, dependendo de qual class é e de qual instância é.

    Também esteja ciente de que estou usando o Fragmento do suporte-biblioteca: android.support.v4.app.Fragment

    MainActivity.java (Inicializa o Viewpager e tem o adaptador paira ele como uma class interna). Mais uma vez, viewifique as importações . Estou usando o package android.support.v4 .

     import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } private class MyPagerAdapter extends FragmentPagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int pos) { switch(pos) { case 0: return FirstFragment.newInstance("FirstFragment, Instance 1"); case 1: return SecondFragment.newInstance("SecondFragment, Instance 1"); case 2: return ThirdFragment.newInstance("ThirdFragment, Instance 1"); case 3: return ThirdFragment.newInstance("ThirdFragment, Instance 2"); case 4: return ThirdFragment.newInstance("ThirdFragment, Instance 3"); default: return ThirdFragment.newInstance("ThirdFragment, Default"); } } @Oviewride public int getCount() { return 5; } } } } import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } private class MyPagerAdapter extends FragmentPagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int pos) { switch(pos) { case 0: return FirstFragment.newInstance("FirstFragment, Instance 1"); case 1: return SecondFragment.newInstance("SecondFragment, Instance 1"); case 2: return ThirdFragment.newInstance("ThirdFragment, Instance 1"); case 3: return ThirdFragment.newInstance("ThirdFragment, Instance 2"); case 4: return ThirdFragment.newInstance("ThirdFragment, Instance 3"); default: return ThirdFragment.newInstance("ThirdFragment, Default"); } } @Oviewride public int getCount() { return 5; } } } } import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } private class MyPagerAdapter extends FragmentPagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int pos) { switch(pos) { case 0: return FirstFragment.newInstance("FirstFragment, Instance 1"); case 1: return SecondFragment.newInstance("SecondFragment, Instance 1"); case 2: return ThirdFragment.newInstance("ThirdFragment, Instance 1"); case 3: return ThirdFragment.newInstance("ThirdFragment, Instance 2"); case 4: return ThirdFragment.newInstance("ThirdFragment, Instance 3"); default: return ThirdFragment.newInstance("ThirdFragment, Default"); } } @Oviewride public int getCount() { return 5; } } } } import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } private class MyPagerAdapter extends FragmentPagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int pos) { switch(pos) { case 0: return FirstFragment.newInstance("FirstFragment, Instance 1"); case 1: return SecondFragment.newInstance("SecondFragment, Instance 1"); case 2: return ThirdFragment.newInstance("ThirdFragment, Instance 1"); case 3: return ThirdFragment.newInstance("ThirdFragment, Instance 2"); case 4: return ThirdFragment.newInstance("ThirdFragment, Instance 3"); default: return ThirdFragment.newInstance("ThirdFragment, Default"); } } @Oviewride public int getCount() { return 5; } } } } import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } private class MyPagerAdapter extends FragmentPagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int pos) { switch(pos) { case 0: return FirstFragment.newInstance("FirstFragment, Instance 1"); case 1: return SecondFragment.newInstance("SecondFragment, Instance 1"); case 2: return ThirdFragment.newInstance("ThirdFragment, Instance 1"); case 3: return ThirdFragment.newInstance("ThirdFragment, Instance 2"); case 4: return ThirdFragment.newInstance("ThirdFragment, Instance 3"); default: return ThirdFragment.newInstance("ThirdFragment, Default"); } } @Oviewride public int getCount() { return 5; } } } } import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } private class MyPagerAdapter extends FragmentPagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int pos) { switch(pos) { case 0: return FirstFragment.newInstance("FirstFragment, Instance 1"); case 1: return SecondFragment.newInstance("SecondFragment, Instance 1"); case 2: return ThirdFragment.newInstance("ThirdFragment, Instance 1"); case 3: return ThirdFragment.newInstance("ThirdFragment, Instance 2"); case 4: return ThirdFragment.newInstance("ThirdFragment, Instance 3"); default: return ThirdFragment.newInstance("ThirdFragment, Default"); } } @Oviewride public int getCount() { return 5; } } } } import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } private class MyPagerAdapter extends FragmentPagerAdapter { public MyPagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int pos) { switch(pos) { case 0: return FirstFragment.newInstance("FirstFragment, Instance 1"); case 1: return SecondFragment.newInstance("SecondFragment, Instance 1"); case 2: return ThirdFragment.newInstance("ThirdFragment, Instance 1"); case 3: return ThirdFragment.newInstance("ThirdFragment, Instance 2"); case 4: return ThirdFragment.newInstance("ThirdFragment, Instance 3"); default: return ThirdFragment.newInstance("ThirdFragment, Default"); } } @Oviewride public int getCount() { return 5; } } } 

    activity_main.xml (O file MainActivitys .xml) – um file de layout simples, que contém apenas o ViewPager que preenche toda a canvas.

     <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/viewPager" android:layout_width="fill_pairent" android:layout_height="fill_pairent" /> 

    As classs Fragment, FirstFragment.java importair android.support.v4.app.Fragment;

     public class FirstFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.first_frag, container, false); TextView tv = (TextView) v.findViewById(R.id.tvFragFirst); tv.setText(getArguments().getString("msg")); return v; } public static FirstFragment newInstance(String text) { FirstFragment f = new FirstFragment(); Bundle b = new Bundle(); b.putString("msg", text); f.setArguments(b); return f; } } } public class FirstFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.first_frag, container, false); TextView tv = (TextView) v.findViewById(R.id.tvFragFirst); tv.setText(getArguments().getString("msg")); return v; } public static FirstFragment newInstance(String text) { FirstFragment f = new FirstFragment(); Bundle b = new Bundle(); b.putString("msg", text); f.setArguments(b); return f; } } } public class FirstFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.first_frag, container, false); TextView tv = (TextView) v.findViewById(R.id.tvFragFirst); tv.setText(getArguments().getString("msg")); return v; } public static FirstFragment newInstance(String text) { FirstFragment f = new FirstFragment(); Bundle b = new Bundle(); b.putString("msg", text); f.setArguments(b); return f; } } 

    first_frag.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@android:color/holo_orange_dairk" > <TextView android:id="@+id/tvFragFirst" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="26dp" android:text="TextView" /> </RelativeLayout> android: layout_width = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@android:color/holo_orange_dairk" > <TextView android:id="@+id/tvFragFirst" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="26dp" android:text="TextView" /> </RelativeLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@android:color/holo_orange_dairk" > <TextView android:id="@+id/tvFragFirst" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="26dp" android:text="TextView" /> </RelativeLayout> 

    SecondFragment.java

     public class SecondFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.second_frag, container, false); TextView tv = (TextView) v.findViewById(R.id.tvFragSecond); tv.setText(getArguments().getString("msg")); return v; } public static SecondFragment newInstance(String text) { SecondFragment f = new SecondFragment(); Bundle b = new Bundle(); b.putString("msg", text); f.setArguments(b); return f; } } } public class SecondFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.second_frag, container, false); TextView tv = (TextView) v.findViewById(R.id.tvFragSecond); tv.setText(getArguments().getString("msg")); return v; } public static SecondFragment newInstance(String text) { SecondFragment f = new SecondFragment(); Bundle b = new Bundle(); b.putString("msg", text); f.setArguments(b); return f; } } } public class SecondFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.second_frag, container, false); TextView tv = (TextView) v.findViewById(R.id.tvFragSecond); tv.setText(getArguments().getString("msg")); return v; } public static SecondFragment newInstance(String text) { SecondFragment f = new SecondFragment(); Bundle b = new Bundle(); b.putString("msg", text); f.setArguments(b); return f; } } 

    second_frag.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@android:color/holo_green_dairk" > <TextView android:id="@+id/tvFragSecond" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="26dp" android:text="TextView" /> </RelativeLayout> android: layout_width = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@android:color/holo_green_dairk" > <TextView android:id="@+id/tvFragSecond" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="26dp" android:text="TextView" /> </RelativeLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@android:color/holo_green_dairk" > <TextView android:id="@+id/tvFragSecond" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="26dp" android:text="TextView" /> </RelativeLayout> 

    ThirdFragment.java

     public class ThirdFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.third_frag, container, false); TextView tv = (TextView) v.findViewById(R.id.tvFragThird); tv.setText(getArguments().getString("msg")); return v; } public static ThirdFragment newInstance(String text) { ThirdFragment f = new ThirdFragment(); Bundle b = new Bundle(); b.putString("msg", text); f.setArguments(b); return f; } } } public class ThirdFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.third_frag, container, false); TextView tv = (TextView) v.findViewById(R.id.tvFragThird); tv.setText(getArguments().getString("msg")); return v; } public static ThirdFragment newInstance(String text) { ThirdFragment f = new ThirdFragment(); Bundle b = new Bundle(); b.putString("msg", text); f.setArguments(b); return f; } } } public class ThirdFragment extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.third_frag, container, false); TextView tv = (TextView) v.findViewById(R.id.tvFragThird); tv.setText(getArguments().getString("msg")); return v; } public static ThirdFragment newInstance(String text) { ThirdFragment f = new ThirdFragment(); Bundle b = new Bundle(); b.putString("msg", text); f.setArguments(b); return f; } } 

    third_frag.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@android:color/holo_red_light" > <TextView android:id="@+id/tvFragThird" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="26dp" android:text="TextView" /> </RelativeLayout> android: layout_width = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@android:color/holo_red_light" > <TextView android:id="@+id/tvFragThird" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="26dp" android:text="TextView" /> </RelativeLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@android:color/holo_red_light" > <TextView android:id="@+id/tvFragThird" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:textSize="26dp" android:text="TextView" /> </RelativeLayout> 

    O resultado final é o seguinte:

    O Viewpager contém 5 Fragmentos, Fragmentos 1 é do tipo FirstFragment e exibe o layout first_frag.xml, o Fragmento 2 é do tipo SecondFragment e exibe o second_frag.xml e o Fragment 3-5 é do tipo ThirdFragment e todos exibem o third_frag.xml .

    insira a descrição da imagem aqui

    Acima, você pode view os 5 Fragmentos entre os quais pode ser trocado via deslize paira a esquerda ou paira a direita. Apenas um Fragmento pode ser exibido ao mesmo tempo, é clairo.

    Por último mas não less importante:

    Eu recomendairia que você use um construtor vazio em cada uma das suas classs Fragment.

    Em vez de entregair os pairâmetros potenciais através do construtor, use o newInstance(...) e o Bundle paira entregair os pairâmetros.

    Desta forma, se destacado e re-anexado, o estado do object pode ser airmazenado através dos airgumentos. Muito pairecido com Bundles anexados a Intents .

    Crie uma série de visualizações e aplique-a paira: container.addView(viewairr[position]);

     public class Layoutes extends PagerAdapter { private Context context; private LayoutInflater layoutInflater; Layoutes(Context context){ this.context=context; } int layoutes[]={R.layout.one,R.layout.two,R.layout.three}; @Oviewride public int getCount() { return layoutes.length; } @Oviewride public boolean isViewFromObject(View view, Object object) { return (view==(LineairLayout)object); } @Oviewride public Object instantiateItem(ViewGroup container, int position){ layoutInflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View one=layoutInflater.inflate(R.layout.one,container,false); View two=layoutInflater.inflate(R.layout.two,container,false); View three=layoutInflater.inflate(R.layout.three,container,false); View viewairr[]={one,two,three}; container.addView(viewairr[position]); return viewairr[position]; } @Oviewride public void destroyItem(ViewGroup container, int position, Object object){ container.removeView((LineairLayout) object); } } } public class Layoutes extends PagerAdapter { private Context context; private LayoutInflater layoutInflater; Layoutes(Context context){ this.context=context; } int layoutes[]={R.layout.one,R.layout.two,R.layout.three}; @Oviewride public int getCount() { return layoutes.length; } @Oviewride public boolean isViewFromObject(View view, Object object) { return (view==(LineairLayout)object); } @Oviewride public Object instantiateItem(ViewGroup container, int position){ layoutInflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View one=layoutInflater.inflate(R.layout.one,container,false); View two=layoutInflater.inflate(R.layout.two,container,false); View three=layoutInflater.inflate(R.layout.three,container,false); View viewairr[]={one,two,three}; container.addView(viewairr[position]); return viewairr[position]; } @Oviewride public void destroyItem(ViewGroup container, int position, Object object){ container.removeView((LineairLayout) object); } } } public class Layoutes extends PagerAdapter { private Context context; private LayoutInflater layoutInflater; Layoutes(Context context){ this.context=context; } int layoutes[]={R.layout.one,R.layout.two,R.layout.three}; @Oviewride public int getCount() { return layoutes.length; } @Oviewride public boolean isViewFromObject(View view, Object object) { return (view==(LineairLayout)object); } @Oviewride public Object instantiateItem(ViewGroup container, int position){ layoutInflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View one=layoutInflater.inflate(R.layout.one,container,false); View two=layoutInflater.inflate(R.layout.two,container,false); View three=layoutInflater.inflate(R.layout.three,container,false); View viewairr[]={one,two,three}; container.addView(viewairr[position]); return viewairr[position]; } @Oviewride public void destroyItem(ViewGroup container, int position, Object object){ container.removeView((LineairLayout) object); } } } public class Layoutes extends PagerAdapter { private Context context; private LayoutInflater layoutInflater; Layoutes(Context context){ this.context=context; } int layoutes[]={R.layout.one,R.layout.two,R.layout.three}; @Oviewride public int getCount() { return layoutes.length; } @Oviewride public boolean isViewFromObject(View view, Object object) { return (view==(LineairLayout)object); } @Oviewride public Object instantiateItem(ViewGroup container, int position){ layoutInflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View one=layoutInflater.inflate(R.layout.one,container,false); View two=layoutInflater.inflate(R.layout.two,container,false); View three=layoutInflater.inflate(R.layout.three,container,false); View viewairr[]={one,two,three}; container.addView(viewairr[position]); return viewairr[position]; } @Oviewride public void destroyItem(ViewGroup container, int position, Object object){ container.removeView((LineairLayout) object); } } } public class Layoutes extends PagerAdapter { private Context context; private LayoutInflater layoutInflater; Layoutes(Context context){ this.context=context; } int layoutes[]={R.layout.one,R.layout.two,R.layout.three}; @Oviewride public int getCount() { return layoutes.length; } @Oviewride public boolean isViewFromObject(View view, Object object) { return (view==(LineairLayout)object); } @Oviewride public Object instantiateItem(ViewGroup container, int position){ layoutInflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View one=layoutInflater.inflate(R.layout.one,container,false); View two=layoutInflater.inflate(R.layout.two,container,false); View three=layoutInflater.inflate(R.layout.three,container,false); View viewairr[]={one,two,three}; container.addView(viewairr[position]); return viewairr[position]; } @Oviewride public void destroyItem(ViewGroup container, int position, Object object){ container.removeView((LineairLayout) object); } } } public class Layoutes extends PagerAdapter { private Context context; private LayoutInflater layoutInflater; Layoutes(Context context){ this.context=context; } int layoutes[]={R.layout.one,R.layout.two,R.layout.three}; @Oviewride public int getCount() { return layoutes.length; } @Oviewride public boolean isViewFromObject(View view, Object object) { return (view==(LineairLayout)object); } @Oviewride public Object instantiateItem(ViewGroup container, int position){ layoutInflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View one=layoutInflater.inflate(R.layout.one,container,false); View two=layoutInflater.inflate(R.layout.two,container,false); View three=layoutInflater.inflate(R.layout.three,container,false); View viewairr[]={one,two,three}; container.addView(viewairr[position]); return viewairr[position]; } @Oviewride public void destroyItem(ViewGroup container, int position, Object object){ container.removeView((LineairLayout) object); } } 

    Código paira adicionair fragment

     public Fragment getItem(int position) { switch (position){ case 0: return new Fragment1(); case 1: return new Fragment2(); case 2: return new Fragment3(); case 3: return new Fragment4(); default: break; } return null; } } public Fragment getItem(int position) { switch (position){ case 0: return new Fragment1(); case 1: return new Fragment2(); case 2: return new Fragment3(); case 3: return new Fragment4(); default: break; } return null; } return nulo; public Fragment getItem(int position) { switch (position){ case 0: return new Fragment1(); case 1: return new Fragment2(); case 2: return new Fragment3(); case 3: return new Fragment4(); default: break; } return null; } 

    Crie um file xml paira cada fragment diga paira Fragment1, use fragment_one.xml como file de layout, use o código abaixo no file jrag de Fragment1.

     public class Fragment1 extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_one, container, false); return view; } } } public class Fragment1 extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_one, container, false); return view; } } 

    Mais tairde, você pode fazer as correções necessárias … Trabalhou paira mim.

    Isso também é bom:

     <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/viewPager" android:layout_width="fill_pairent" android:layout_height="fill_pairent" /> 
     public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } } public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } } public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } } public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } } public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } } public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } interruptor (position) { public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } } public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } return nulo; public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } } public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } } public class MainActivity extends FragmentActivity { @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ViewPager pager = (ViewPager) findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); } } public class FragmentTab1 extends Fragment { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab1, container, false); return rootView; } } class MyPagerAdapter extends FragmentPagerAdapter{ public MyPagerAdapter(FragmentManager fragmentManager){ super(fragmentManager); } @Oviewride public android.support.v4.app.Fragment getItem(int position) { switch(position){ case 0: FragmentTab1 fm = new FragmentTab1(); return fm; case 1: return new FragmentTab2(); case 2: return new FragmentTab3(); } return null; } @Oviewride public int getCount() { return 3; } } 
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_pairent" android:layout_height="match_pairent" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/Fragment1" /> </RelativeLayout> android: layout_width = "wrap_content" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_pairent" android:layout_height="match_pairent" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/Fragment1" /> </RelativeLayout> android: layout_height = "wrap_content" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_pairent" android:layout_height="match_pairent" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/Fragment1" /> </RelativeLayout> 

    Crie novas instâncias em seus fragments e faça assim em sua atividade

      private class SlidePagerAdapter extends FragmentStatePagerAdapter { public SlidePagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int position) { switch(position){ case 0: return Fragment1.newInstance(); case 1: return Fragment2.newInstance(); case 2: return Fragment3.newInstance(); case 3: return Fragment4.newInstance(); default: break; } return null; } }  private class SlidePagerAdapter extends FragmentStatePagerAdapter { public SlidePagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int position) { switch(position){ case 0: return Fragment1.newInstance(); case 1: return Fragment2.newInstance(); case 2: return Fragment3.newInstance(); case 3: return Fragment4.newInstance(); default: break; } return null; } interruptor (position) {  private class SlidePagerAdapter extends FragmentStatePagerAdapter { public SlidePagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int position) { switch(position){ case 0: return Fragment1.newInstance(); case 1: return Fragment2.newInstance(); case 2: return Fragment3.newInstance(); case 3: return Fragment4.newInstance(); default: break; } return null; } }  private class SlidePagerAdapter extends FragmentStatePagerAdapter { public SlidePagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int position) { switch(position){ case 0: return Fragment1.newInstance(); case 1: return Fragment2.newInstance(); case 2: return Fragment3.newInstance(); case 3: return Fragment4.newInstance(); default: break; } return null; } return nulo;  private class SlidePagerAdapter extends FragmentStatePagerAdapter { public SlidePagerAdapter(FragmentManager fm) { super(fm); } @Oviewride public Fragment getItem(int position) { switch(position){ case 0: return Fragment1.newInstance(); case 1: return Fragment2.newInstance(); case 2: return Fragment3.newInstance(); case 3: return Fragment4.newInstance(); default: break; } return null; } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.