Skip to content

Instantly share code, notes, and snippets.

@masaibar
Created January 6, 2019 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masaibar/7a11e969fa3bc8b56c705cc88339fa8d to your computer and use it in GitHub Desktop.
Save masaibar/7a11e969fa3bc8b56c705cc88339fa8d to your computer and use it in GitHub Desktop.
ScrollViewを持ったAlertDialogを表示する ref: https://qiita.com/masaibar/items/33ac44545c0d37caee50
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
AlertDialog.Builder(applicationContext)
.setTitle("title")
.setView(R.layout.view_scrollable_text)
.setPositiveButton(
"OK"
) { _, _ ->
// Do nothing
}
.show()
}
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hoge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="fuga" />
</LinearLayout>
</ScrollView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment