Open notEvil opened 1 year ago
This
function t(orientation, weight) { return ui.newView('text').text(orientation + ' ' + weight) } function l1(y, orientation, weight) { var linear_layout = ui.addLinearLayout(0, y, 1, 0.09) if (orientation != 'vertical') linear_layout.orientation(orientation) linear_layout.add(t(orientation, weight), 'name', weight) } l1(0.1, 'horizontal', 0) l1(0.2, 'vertical', 0) l1(0.3, 'horizontal', 1) l1(0.4, 'vertical', 1) function l2(y, orientation, weight) { var linear_layout = ui.addLinearLayout(0, y, 1, 0.09) if (orientation != 'vertical') linear_layout.orientation(orientation) linear_layout.addView(t(orientation, weight), new android.widget.LinearLayout.LayoutParams(-2, -2, weight)) } l2(0.6, 'horizontal', 0) l2(0.7, 'vertical', 0) l2(0.8, 'horizontal', 1) l2(0.9, 'vertical', 1)
creates a couple of linear layouts in two ways. The first using PLinearLayout.add and the second LinearLayout.addView with explicit LinearLayout.LayoutParams. Labels 1, 2 and 4 are not visible because their width is set to 0, see https://github.com/victordiaz/PHONK/blob/3c4024e447bdde2615403eaa3fc3e65005886590/PHONK-android/phonk_apprunner/src/main/java/io/phonk/runner/apprunner/api/widgets/PLinearLayout.java#L81
PLinearLayout.add
LinearLayout.addView
LinearLayout.LayoutParams
This
creates a couple of linear layouts in two ways. The first using
PLinearLayout.add
and the secondLinearLayout.addView
with explicitLinearLayout.LayoutParams
. Labels 1, 2 and 4 are not visible because their width is set to 0, see https://github.com/victordiaz/PHONK/blob/3c4024e447bdde2615403eaa3fc3e65005886590/PHONK-android/phonk_apprunner/src/main/java/io/phonk/runner/apprunner/api/widgets/PLinearLayout.java#L81