It is possible to open activity within framelayout

0

Is it possible to "inflate" an activity (in this activity has a recicleview) inside a framelayout? if not, what I use to open 3 different activitys, keeping the navigation bar down as in the screenshot

  

public class PrincipalActivity extends AppCompatActivity {

private TextView mTextMessage;

private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
        = new BottomNavigationView.OnNavigationItemSelectedListener() {

    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
        switch (item.getItemId()) {
            case R.id.navigation_home:
                mTextMessage.setText(R.string.title_home);

                return true;
            case R.id.navigation_dashboard:
                mTextMessage.setText(R.string.title_dashboard);
                return true;
            case R.id.navigation_notifications:
                mTextMessage.setText(R.string.title_notifications);
                return true;
        }
        return false;
    }

};

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

    mTextMessage = (TextView) findViewById(R.id.message);
    BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}

}

    
asked by anonymous 23.06.2017 / 05:09

2 answers

1

What you are looking for are "Fragments", which you can inflate as many as you want within an activity

    
23.06.2017 / 05:13
1

You can use a layout with ViewPager at the top (to display the contents and slide between them with your finger horizontally) and in the footer a TabLayout to mount the bar as the photo and also toggle the contents of the ViewPager. Each content should be implemented in Fragments and you will need to create an Adapter to manage these Fragments in the ViewPager and link to the TabLayout.

This link has an example: link

    
23.06.2017 / 05:24