Reputation: 5511
Is there a way to modify the value of a resource while assigning it in XML?
For example, this works fine:
android:layout_height="?attr/actionBarSize"
But I would like to double this value as its width:
// this obviously doesn't work
android:layout_width="?attr/actionBarSize * 2"
Is there some way to accomplish this?
Upvotes: 1
Views: 91
Reputation: 707
You can do this programmatically.
LinearLayout layout = (LinearLayout) findViewById(R.id.yourlayout);
LayoutParams params = layout.getLayoutParams();
params.width *= 2;
Upvotes: 1