SHARE
TWEET

Untitled

a guest May 24th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class SampleAdapterUI : AnkoComponent<ViewGroup> {
  2.  
  3.     lateinit var mCard: LinearLayout
  4.     lateinit var mName: TextView
  5.     lateinit var mDelete: ImageView
  6.  
  7.     override fun createView(ui: AnkoContext<ViewGroup>) = with(ui) {
  8.         cardView {
  9.             cardElevation = dip(3).toFloat()
  10.             radius = 8F
  11.             setContentPadding(25, 20, 25, 20)
  12.             lparams(width = matchParent, height = wrapContent) {
  13.                 horizontalMargin = dip(10)
  14.                 verticalMargin = dip(5)
  15.             }
  16.  
  17.             mCard = linearLayout {
  18.                 mName = textView {
  19.                     textSize = 20F
  20.                 }.lparams(width = 0, weight = 1F)
  21.  
  22.                 mDelete = imageView(R.drawable.ic_delete) {
  23.                     scaleType = ImageView.ScaleType.FIT_CENTER
  24.                 }.lparams(width = 44, height = 44) {
  25.                     gravity = Gravity.CENTER_VERTICAL
  26.                 }
  27.             }
  28.         }
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top