Я импортировал библиотеки AndroidX и метод панели инструментов findViewById больше не работает.
BaseAppCompatActivity.java:
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.navigation.NavigationView;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.widget.Toolbar;
FrameLayout lytContent;
//protected FrameLayout leftDrawer;
NavigationView leftDrawer;
// protected FrameLayout rightDrawer;
DrawerLayout drawerLayout;
ActionBarDrawerToggle mDrawerToggle;
//protected RelativeLayout lytContents;
final Handler mHandler = new Handler();
protected SwipeRefreshLayout swipeView;
protected CoordinatorLayout coordinatorLayout;
protected Toolbar toolbar;
private MenuItem menuProgress;
private View lytDrawer;
private View lytDrawerHeader;
private View lytProgress;
private ProgressBar progressBase;
private View lytMessage;
private CustomTextView txtMessage;
private ImageView ivMessage;
private ImageView ivUserDP;
private ProfileBean profileBean;
private CustomTextView txtName;
private CustomTextView txtPhone;
private CustomTextView txtEmail;
private boolean isDriverLocationUpdated;
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//leftDrawer = (FrameLayout) findViewById(R.id.leftDrawer);
leftDrawer = (NavigationView) findViewById(R.id.navigation_view_base_appcompat);
// rightDrawer = (FrameLayout)findViewById(R.id.rightDrawer);
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout_appcompat);
lytContent = (FrameLayout) findViewById(R.id.lyt_contents_appcompat);
coordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinatorlayout_base_appcompat);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// toolbar.setPadding(0, App.getStatusBarHeight(getApplicationContext()), 0, 0);
leftDrawer.setPadding(0, 0, 0, 0);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
}
Также метод getWindow не работает.Я использую sdkVersion 28.
реализация 'androidx.legacy: legacy-support-v4: 1.0.0'
реализация 'androidx.appcompat: appcompat: 1.0.2'
реализация 'com.google.android.material: материал: 1.0.0'
реализация 'androidx.recyclerview: recyclerview: 1.0.0'
реализация 'androidx.cardview:cardview: 1.0.0 '