NiVeR
NiVeR

Reputation: 9786

ActionBar add spacing between components

I want to add some spacing between the actionbar's back navigation button, icon and title. Anyone knows how to do it?

Upvotes: 1

Views: 309

Answers (1)

Nikola Despotoski
Nikola Despotoski

Reputation: 50538

int actionbarTitleId = getResources().getIdentifier("android:id/action_bar_title", null, null); //TextView hosted in LinearLayout
int upImageViewId = getResources().getIdentifier("android:id/up", null, null);//ImageView hosted in LinearLayout or HomeView
int homeId = android.R.id.home; //ImageView hosted in HomeView

Use findViewById with each of the ids to get View (or appropriate cast) for each.

Try not to modify the LayoutParams. But add padding between them or just use existing LayoutParams to modify the margins.

Upvotes: 3

Related Questions