FORUMS
Remove All Ads from XDA

TooBar problem using Outlined text fields

1 posts
Thanks Meter: 0
 
By 1lbert0, Junior Member on 9th June 2019, 08:52 PM
Post Reply Email Thread
Hi everyone,
I'm trying to use a ToolBar in my android studio project. In build gradle(module app) I implements :
'com.google.android.material:material:1.1.0-alpha07' //I use this because i want '<com.google.android.material.textfield.TextInputL ayout>' on my xml/layout files,
'com.android.support.constraint:constraint-layout:1.1.3',
'com.android.support.constraint:constraint-layout:1.1.3',
testImplementation 'junit:junit:4.12'.
In MainActivity.Java:
public class MainActivity extends Activity {

@override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
}
}

If I use 'toolbar.inflateMenu(R.menu.menu_bar);' or 'setSupportActionBar(toolbar)' when I ran my app it crashs immediately.
I tried also 'setActionBar();' the brackets should be filled this way 'Toolbar toolbar' as 'toolbar' I put 'toolbar' ;
but I don't know what to put as 'Toolbar'.
I've looked for solution but always in the build gradle(module app) was implemented 'com.android.support:appcompat-v7:28.0.0'.
And if I implement both of them('com.android.support:appcompat-v7:28.0.0' and 'com.google.android.material:material:1.1.0-alpha07') my app crashs immediately.

Can anyone help me to set my toolbar as an ActinBar?
If you need more specification on my project feel free to ask.

Tanks,
1lbert0
 
 
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes