Last active
September 21, 2019 00:38
-
-
Save hjiee/710decd70f05ff3a0314bf24b1dab20d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListViewAdapter( | |
private val layoutResId: Int, | |
private val items: List<String> | |
) : BaseAdapter() { | |
// .. 중략 | |
override fun getView(position: Int, view: View?, parent: ViewGroup?): View? { | |
var convertView = view | |
convertView = LayoutInflater.from(parent?.context).inflate(layoutResId, parent, false) | |
convertView?.tv_item?.text = items[position] | |
return convertView | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
lv_list.adapter = ListViewAdapter( | |
R.layout.listview_item, | |
createList() | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment