I am new to android, working on my first App .I am stuck at a problem, I see extra margin in the action bar when I run my App on API 18 and above .
I googled and found this answer :- Android: remove left margin from actionbar's custom layout
But I don't think this its applicable to me, Firstly,(As per the solution suggested in the link above) 1)I am not using a toolbar, but a actionbar 2)Android Studio throws error for the below code
Toolbar parent =(Toolbar) customView.getParent();
parent.setContentInsetsAbsolute(0,0);
Saying, minimum is 14 and setContentInsetsAbsolute needs API 21. So I did this ,
if(Build.VERSION.SDK_INT == 21 ){
Toolbar parent =(Toolbar) customView.getParent();
parent.setContentInsetsAbsolute(0,0);
}
But this is not helping. Where am I going wrong and how to fix the issue?