Skip to content

Instantly share code, notes, and snippets.

View SrgGrch's full-sized avatar
🧨

Sergey Grechishnikov SrgGrch

🧨
View GitHub Profile
fab.setOnClickListener { view ->
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)
fab.setOnClickListener { view ->
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
...
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/myLovelyButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"