Skip to content

Instantly share code, notes, and snippets.

@kingsleyadio
Last active January 29, 2024 17:41
Show Gist options
  • Save kingsleyadio/b1c431da859ff0adf9c5a660c04da9bf to your computer and use it in GitHub Desktop.
Save kingsleyadio/b1c431da859ff0adf9c5a660c04da9bf to your computer and use it in GitHub Desktop.
class DebugActivity : AppCompatActivity(R.layout.a_debug)
class DebugFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
) = ComposeView(requireContext()).apply {
setContent {
MaterialTheme { DebugScreen() }
}
}
}
@Composable
private fun DebugScreen() {
Scaffold(
modifier = Modifier.onSizeChanged { Log.i("DebugScreen", "Size changed: $it") }
) { contentPadding ->
LazyColumn(Modifier.padding(contentPadding)) {
items(20) { index ->
Column(Modifier.clickable {}) {
Column(Modifier.padding(16.dp)) {
Text("Title $index")
Text("Description $index")
}
Divider()
}
}
}
}
}
// a_debug.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<View
android:id="@+id/bottomNavigationView"
android:layout_width="match_parent"
android:layout_height="64dp"
android:background="#FFAA0000"
android:layout_alignParentBottom="true"
/>
<fragment
android:id="@+id/container"
class="com.example.DebugFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottomNavigationView"
/>
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment