I\'m trying to make Toolbar with EditText within it like this:
Right now I can do some thing similar but only with static title, Any ideas to get started?
I have done this like below:
There is Toolbar
as AppBar
(aka ActionBar
) at the top and second toolbar below it with two EditText
. First Toolbar is under CollapsingToolbarLayout
in case you want it to be collapsed.
Java
:
public class MainActivity extends AppCompatActivity {
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar_1);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
activity_main.xml
:
Colors
:
#303F9F
#3F51B5
#00E5FF
And styles.xml
:
Use android:theme="@style/AppTheme"
for application in manifest and android:theme="@style/AppTheme.Base" for
MainActivity`.