import
android.os.Bundle
import
androidx.activity.ComponentActivity
import
androidx.activity.compose.setContent
import
androidx.compose.foundation.layout.Column
import
androidx.compose.foundation.layout.fillMaxWidth
import
androidx.compose.foundation.layout.padding
import
androidx.compose.foundation.text.selection.DisableSelection
import
androidx.compose.foundation.text.selection.SelectionContainer
import
androidx.compose.material.MaterialTheme
import
androidx.compose.material.Surface
import
androidx.compose.material.Text
import
androidx.compose.runtime.Composable
import
androidx.compose.ui.Modifier
import
androidx.compose.ui.text.style.TextAlign
import
androidx.compose.ui.tooling.preview.Preview
import
androidx.compose.ui.unit.dp
import
com.example.jetpack_playground.ui.theme.Jetpack_playgroundTheme
class
MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super
.onCreate(savedInstanceState)
setContent {
Jetpack_playgroundTheme {
Surface(color = MaterialTheme.colors.background) {
Column {
CustomSelectableText()
}
}
}
}
}
}
@Composable
fun CustomSelectableText() {
SelectionContainer() {
Column() {
Text(
text =
"Welcome to Geeks for Geeks,A Computer Science portal for geeks."
+
"It contains well written, well thought and well explained computer "
+
"science and programming articles, quizzes and ..."
,
textAlign = TextAlign.Center,
modifier = Modifier
.padding(start =
10
.dp, top =
20
.dp)
.fillMaxWidth()
)
}
}
}
@Preview
(showBackground =
true
)
@Composable
fun DefaultPreview() {
Jetpack_playgroundTheme {
CustomSelectableText()
}
}