V
V
Volodar Znatsky2017-06-14 22:16:11
Android
Volodar Znatsky, 2017-06-14 22:16:11

Why is the top toolbar not displayed in the application?

android studio.
And so the problem is that, as you can see from the picture, there should be a toolbar, but it is not in reality. I noticed the loss when I was writing Java application code. When removing the code, the toolbar is not returned. I did not touch anything in the parameter files to intentionally disable the toolbar. Only EditText hangs.
The situation is the same without the emulator - on a regular device. a5b2b92820ee479bb89dbb0c61c717d5.jpg
Java code cut. And so and so the same thing, but the limit swears.

package myrause.mrconnect;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.Socket;
import java.util.Calendar;
import java.util.Enumeration;
import java.util.StringTokenizer;
import java.util.regex.Pattern;

public class main extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        send = (Button) findViewById(R.id.action_send);
        console = (Button) findViewById(R.id.action_console);
        delete = (Button) findViewById(R.id.action_delete);
        editText = (EditText) findViewById(R.id.editText);
        
        //IpV4();
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }
}

menu_main.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item android:id="@+id/action_send"
        android:title="SEND"
        android:orderInCategory="102"
        app:showAsAction="always"
        android:icon="@android:drawable/ic_menu_send" />

    <item android:id="@+id/action_console"
        android:title="CONSOLE"
        android:orderInCategory="101"
        app:showAsAction="always"
        android:icon="@android:drawable/ic_menu_sort_by_size"/>

    <item android:id="@+id/action_delete"
        android:title="DELETE"
        android:orderInCategory="100"
        app:showAsAction="always"
        android:icon="@android:drawable/ic_menu_close_clear_cancel"/>
</menu>

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="myrause.mrconnect.main">
    <EditText   android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:id="@+id/editText"
        android:gravity="top|left"
        android:inputType="textMultiLine" />

</android.support.constraint.ConstraintLayout>

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="myrause.mrconnect">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".main">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

As you can see, I did little, but the jamb appeared.
Could this be an IDE, Windows and components issue when compiling? Have you ever experienced this? What do you think to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Kovalev, 2017-06-15
@zeekenru

Add Toolbar to your markup file (activity_main.xml) and inherit AppTheme from any theme with NoActionBar

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question