horizontalLayout
anko / kotlin でa を行う良い方法は何ですか? verticalLayout
正常に動作します-向きを設定できますが、気分が悪くなります。そこに何が欠けているのかわからない。
2632 次
2 に答える
17
linearLayout()
代わりに関数を使用してください。
linearLayout {
button("Some button")
button("Another button")
}
于 2015-05-01T21:20:41.960 に答える
0
ええ、LinearLayout
デフォルトでは水平ですが、私はより具体的にする傾向があり、そのために別のhorizontalLayout
関数を使用しています。
horizontalLayout
プロジェクトに関数を追加するだけです。
val HORIZONTAL_LAYOUT_FACTORY = { ctx: Context ->
val view = _LinearLayout(ctx)
view.orientation = LinearLayout.HORIZONTAL
view
}
inline fun ViewManager.horizontalLayout(@StyleRes theme: Int = 0, init: _LinearLayout.() -> Unit): _LinearLayout {
return ankoView(HORIZONTAL_LAYOUT_FACTORY, theme, init)
}
Anko で機能リクエストを開きました: https://github.com/Kotlin/anko/issues/413
于 2017-06-17T08:40:57.940 に答える