Hello everyone, created a menu, added an update icon should appear there and when you press the progress bar spins, you did it before, it might have gotten tired that you ran away from the eye) The sign does not change and when you click on the menu sign, nothing happens but the markings themselves down
this is menu_main.xml:
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"> <item android:title="Item" android:id="@+id/action_progress_show" android:icon="@drawable/ic_refresh_white_36dp" android:showAsAction="always"/> </menu> this is a bar
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ProgressBar android:id="@+id/progressBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" /> </RelativeLayout> and this is my MainActivity:
public class MainActivity extends AppCompatActivity { Menu mymenu; MenuItem progress_menu_item; Menu mymenu; MenuItem progress_menu_item; ... @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); mymenu = menu; progress_menu_item = mymenu.findItem(R.id.action_progress_show); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_progress_show) { progress_menu_item.setActionView(R.layout.menu_item_layout); return true; } return super.onOptionsItemSelected(item); }
InstantRunbuggy - Yuriy SPb ♦