본문 바로가기

전체 글310

Kotlin] 안드로이드 Recyclerview 아이템 폭 & 간격 & 구분선 표시 구분선 넣기 // 구분선 넣기 val dividerItemDecoration = DividerItemDecoration(recyclerView.context, LinearLayoutManager(this).orientation) recyclerView.addItemDecoration(dividerItemDecoration) 아이템 간격(폭) 조절 class MyAdapter(private var datas: ArrayList) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { ... return MyViewHolder(view) } .... override fu.. 2020. 4. 17.
Kotlin] 안드로이드 구글 캘린더 일정 추가하기 button.setOnClickListener { val intent = Intent(Intent.ACTION_INSERT) .setData(CONTENT_URI) .putExtra(TITLE, "제목 ") .putExtra(EVENT_LOCATION, "자앙소") .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, System.currentTimeMillis()) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, System.currentTimeMillis()+ (60*60*1000)) startActivity(intent) } 2020. 4. 13.
Kotlin] 안드로이드 앱 실행 시 전면 광고 넣기 https://stackoverflow.com/questions/24125022/want-to-show-admob-interstitial-on-app-start 2020. 4. 8.
Kotlin] MultiSelectListPreference 선택값 summary에 반영 val Pref = findPreference("Category") as MultiSelectListPreference Pref.summary = Pref.values.joinToString(", ") //sumary에 반영 Pref.setOnPreferenceChangeListener { preference, newValue -> val newValueSet = newValue as? HashSet ?: return@setOnPreferenceChangeListener true Pref.summary = newValueSet.joinToString(", ") true } 2020. 4. 4.
Kotlin] ListPreference 선택값 summary에 반영 val backgroundColorCategoryPref = findPreference("backgroundColorCategory") as ListPreference // 선택값 summary에 반영 backgroundColorCategoryPref.setOnPreferenceChangeListener { preference, newValue -> if (preference is ListPreference) { val index = backgroundColorCategoryPref.findIndexOfValue(newValue.toString()) backgroundColorCategoryPref.summary = backgroundColorCategoryPref.entries[index] } Log... 2020. 4. 4.
Kotlin] toast 메세지 // 배경, 글자 크기, 글자색 설정하기 // 배경은 toast_background val toast = Toast.makeText(applicationContext, R.string.all_done_message, Toast.LENGTH_LONG) val view = toast.view view.setBackgroundResource(R.drawable.toast_background) // 글자 크기 36f, 글자색 white val group = toast.view as ViewGroup val msgTextView = group.getChildAt(0) as TextView msgTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36f) msgTextView.setTextColor(resources... 2020. 3. 31.