I have a layout with element TextView
<TextView android:textColor="#ffffff" android:text="18 августа"
android:id="@+id/program_day1" android:layout_gravity="center"
android:textSize="18sp" android:textStyle="bold"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_weight="1" android:gravity="center" />
How can I detect the real size (and margins) of this in the onStart (or other) event? Now it shows “-2” values
Views don’t get height or width until they are actually drawn on screen.
Try to show the width in the
onSizeChangedfunction. Check if a real size will be shown. Usegetwidth.