Skip to content

Commit

Permalink
Merge pull request #24 from robertschulze/patch-1
Browse files Browse the repository at this point in the history
Account for hierarchy change starting from Android N
  • Loading branch information
VC-WhitchurchA authored Jun 11, 2018
2 parents 25bcfd3 + e032e52 commit b05a193
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ protected void onPostCreate(Bundle savedInstanceState) {
AppBarLayout bar;

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
LinearLayout root = (LinearLayout) findViewById(android.R.id.list).getParent().getParent().getParent();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
root = (LinearLayout) findViewById(android.R.id.list).getParent().getParent().getParent().getParent();
} else {
root = (LinearLayout) findViewById(android.R.id.list).getParent().getParent().getParent();
}
bar = (AppBarLayout) LayoutInflater.from(this).inflate(R.layout.toolbar_settings, root, false);
root.addView(bar, 0);
} else {
Expand Down

0 comments on commit b05a193

Please sign in to comment.