I want to translate relative layout in vertical axis by %50 percentage of its height. How to do it?
<RelativeLayout
android:id="@+id/rl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:translationY="50dp"> <!-- i tried 50% , .50. But it does not work.
Then i tried to find its height in onCreate of the activity, then translate dynamically %50 percentage. but height returns zero.
onCreate(){
...
RelativeLayout rl = findViewById(R.id.RL);
rl.getHeight();
}
How to do it?