It is possible to open Activity inside framelayout

Asked

Viewed 143 times

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 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);
}

}

app

2 answers

1


what you are looking for are "Fragments", which you can inflate as many as you want inside an Activity

1

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

In this link is an example: http://blog.romarconsultoria.com.br/2015/12/como-exibir-tabs-utilizando-tablayout-e.html?m=1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.