I want to add view & rotate it by 90 degree programmatically, however I can't figure how to set its dimensions properly.
This is my placeholder:
<FrameLayout
android:layout_width="40dp"
android:layout_height="match_parent"
android:id="@+id/placeholder"
android:orientation="vertical"
android:background="@color/green"
android:layout_weight="1">
And this is how my code looks like:
FrameLayout placeholderView = (FrameLayout) findViewById(R.id.placeholder);
View myView = new View(getApplicationContext());
myView.setBackgroundColor(Color.RED);
myView.setRotation(90);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
myView.setLayoutParams(layoutParams);
placeholderView.addView(myView);
The result is that BOTH width & height get the same value, so the view looks like this:
While I wanted it to expand on entire height of its parent.