main activity
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
initNavigationDrawer();
}
public void initNavigationDrawer() {
}
no activity in mobile_form activity
public class mobile_form extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
view= findViewById(android.R.id.content);
setContentView(R.layout.activity_mobile_form);
}
style.xml
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>
Use Toolbar across all activities (Android)
I tried it but I think navigtion bar is there because the size is changed after adding drawer layout to my second activity but is shows blank white color there.
You don't have action bar in another activity, because you do not set it in another activity. This part of code should be added to each onCreate method:
Because by default, you removed ActionBar from any activity by using:
in your application code.
P.S. Btw, this part of code:
Should be also added to each activity layout file, if you wish to use toolbar at that activities.
P.S.S. You should read Adding the App Bar and Creating a Navigation Drawer tutorials from google.