Support Fragment in android-compiler-plugin
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World, MyActivity"
|
||||
android:id="@+id/textField2"/>
|
||||
</LinearLayout>
|
||||
|
||||
+16
@@ -1,9 +1,14 @@
|
||||
package com.example.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Fragment
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.view.View
|
||||
|
||||
import kotlinx.android.synthetic.main.*
|
||||
import kotlinx.android.synthetic.fragment.*
|
||||
|
||||
public class MyActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@@ -12,3 +17,14 @@ public class MyActivity : Activity() {
|
||||
textField.setText("test")
|
||||
}
|
||||
}
|
||||
|
||||
public class MyFragment : Fragment() {
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
return inflater.inflate(R.layout.fragment, container, false)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
textField2.setText("test fragment")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user