setLayoutParams(): better match Androids behaviour

View.setGravity() specifies gravity of children, not of the view itself
LayoutParams.weight > 0 should cause expansion of widget
This commit is contained in:
Julian Winkler
2023-09-08 18:32:34 +02:00
parent a27cb27638
commit 255eed3e59
6 changed files with 80 additions and 51 deletions

View File

@@ -16,6 +16,8 @@ JNIEXPORT jlong JNICALL Java_android_widget_TextView_native_1constructor(JNIEnv
GtkWidget *wrapper = g_object_ref(wrapper_widget_new());
GtkWidget *label = gtk_label_new(text);
gtk_label_set_wrap(GTK_LABEL(label), TRUE);
gtk_label_set_xalign(GTK_LABEL(label), 0.f);
gtk_label_set_yalign(GTK_LABEL(label), 0.f);
wrapper_widget_set_child(WRAPPER_WIDGET(wrapper), label);
return _INTPTR(label);
}