#java #android #flutter #android-layout #kotlin
#java #Android #трепетание #android-макет #котлин
Вопрос:
Я работаю с представлением платформы в Flutter, и я хочу вернуть ПРЕДСТАВЛЕНИЕ в моем getView()
конструкторе. У меня есть .xml
файл с группой просмотра, к которому я хочу вернуться в этом разделе. Мой вопрос заключается в том, как вернуть это, поскольку мой конструктор возвращает ПРЕДСТАВЛЕНИЕ. Это пример кода:
internal class SBNativeView(context: Context, id: Int, creationParams: Map<String?, Any?>?) : PlatformView, AppCompatActivity() {
private val textView: TextView
override fun getView(): View {
return textView
}
override fun dispose() {}
init {
textView = TextView(context)
textView.textSize = 72f
textView.setBackgroundColor(Color.rgb(255, 255, 255))
textView.text = "Rendered on a native Android view (id: $id)"
}
}
Мне нужно вернуть этот вид
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@ id/loginConstraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/textlayout_login_user_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:id="@ id/edittext_login_user_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="UserID"
android:imeOptions="actionDone"
android:inputType="textVisiblePassword"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@ id/textlayout_login_nickname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
app:layout_constraintTop_toBottomOf="@ id/textlayout_login_user_id">
<com.google.android.material.textfield.TextInputEditText
android:id="@ id/edittext_login_nickname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Nickname"
android:imeOptions="actionDone"
android:inputType="textVisiblePassword"/>
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="@ id/button_login_connect"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginStart="16dp"
android:layout_marginTop="44dp"
android:layout_marginEnd="16dp"
android:background="#774df2"
android:stateListAnimator="@null"
android:text="Connect"
app:layout_constraintTop_toBottomOf="@ id/textlayout_login_nickname"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Как я могу вернуть это представление в getView()?
Комментарии:
1. Вы пытаетесь вернуть вид в сторону Флаттера?
2. Нет, вид с родной стороны на флаттер. Я использовал этот flutter.dev/docs/development/platform-integration/ …
3. Я хочу что-то подобное? @RicharC293 вы нашли какое-нибудь решение?