@@ -26,6 +26,7 @@ def set_title(self, title: str) -> None:
2626 def get_title (self ) -> str :
2727 return self .native_instance .titleForState_ (0 )
2828
29+
2930 class Label :
3031 native_class = ObjCClass ("UILabel" )
3132
@@ -39,6 +40,21 @@ def set_text(self, text: str) -> None:
3940 def get_text (self ) -> str :
4041 return self .native_instance .text ()
4142
43+
44+ class LinearLayout :
45+ native_class = ObjCClass ("UIStackView" )
46+
47+ def __init__ (self ) -> None :
48+ self .native_instance = self .native_class .alloc ().initWithFrame_ (
49+ ((0 , 0 ), (0 , 0 )))
50+ self .native_instance .setAxis_ (0 ) # Set axis to vertical
51+ self .views = []
52+
53+ def add_view (self , view ):
54+ self .views .append (view )
55+ self .native_instance .addArrangedSubview_ (view .native_instance )
56+
57+
4258elif system == "Android" :
4359 from java import jclass
4460
@@ -56,6 +72,7 @@ def set_title(self, title: str) -> None:
5672 def get_title (self ) -> str :
5773 return self .native_instance .getText ().toString ()
5874
75+
5976 class Label :
6077 native_class = jclass ("android.widget.TextView" )
6178
@@ -69,5 +86,20 @@ def set_text(self, text: str) -> None:
6986 def get_text (self ) -> str :
7087 return self .native_instance .getText ().toString ()
7188
89+
90+ class LinearLayout :
91+ native_class = jclass ("android.widget.LinearLayout" )
92+
93+ def __init__ (self ) -> None :
94+ self .native_instance = self .native_class ()
95+ self .native_instance .setOrientation (
96+ 1 ) # Set orientation to vertical
97+ self .views = []
98+
99+ def add_view (self , view ):
100+ self .views .append (view )
101+ self .native_instance .addView (view .native_instance )
102+
103+
72104else :
73105 raise PlatformNotDetectedError ("Platform could not be detected or is unsupported." )
0 commit comments