29
Ich verwende PercentRelativeLayout von Android Prozent Support-Paket. das ist was ich in meinem Layout habe.PercentRelativeLayout, wie die Höhe programmgesteuert
<android.support.percent.PercentRelativeLayout
android:id="@+id/view_parent"
app:layout_heightPercent="68%" android:visibility="invisible"
android:layout_width="match_parent"
android:background="@color/mountain_meadow" android:layout_alignParentTop="true"
android:layout_height="wrap_content">
<View android:id="@+id/view_child" android:layout_width="match_parent" app:layout_heightPercent="30%"
android:layout_alignParentBottom="true"
/>
</android.support.percent.PercentRelativeLayout>
Ich will die Höhe von view_child
programmatisch ändern. Wie kann ich das mit PercentRelativeLayout.LayoutParams
oder auf andere Weise tun.
Wie setzen Sie einen anderen Wert ohne Prozent? Zum Beispiel, marginBottom in dp, mit Prozent-Layout-Parameter? – Gilian
view.requestLayout(); cooler Typ. – msecilmis