Problem: today I downloaded a new Android Studio 1.5 . Created two projects: the first was created normally, and the second ... with a bunch of new code and a rendering error. Created a regular Blank Activity .

As a result, I received the following class MainActivity :

 public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Обычно, вот этот код не генерируется!!! Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); //И этот тоже FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } 

main_activity :

 <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout 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" android:fitsSystemWindows="true" tools:context="com.dugin_rostislav.mynewapplication.MainActivity"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.AppBarLayout> <include layout="@layout/content_main" /> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_dialog_email" /> </android.support.design.widget.CoordinatorLayout> 

From where, in general, all the layout code was taken for me incomprehensibly. Normally, only RelativeLayout generated with a TextView . In addition to the incomprehensible layout I received an error:

Notice: - PorterDuff Color Filters are not supported.

Question: from where did so much code come from and how to make it so that when creating a Blank Activity - I get a regular Blank Activity ?

    1 answer 1

    Blank Activity - a template that contains the elements of material design .

    Just add an Empty Activity .

    • And the rendering error from where? What to do with it? - user189127
    • @ bukashka101, Most likely due to the fact that the project must first be assembled, then it should be rendered. - Dan
    • In my understanding, "to collect" means to compile into .apk. Something tells me that you have something else in mind?) - user189127
    • Yes, compile - Dan
    • one
      For a better understanding, it’s better to do everything manually, starting from creating a Java class and inheriting it from the Activity class to overriding the onCreate method (Ctrl + O) and binding the created and inherited class to your previously created layout via SetContentView(R.layout.your_layuot_name) - maratsoft