목록Android (57)
Hanbit the Developer
In my app, the layout structure is: NestedScrollView -> FrameLayout -> SwipeRefreshLayout -> RecyclerView Before the explanation, see a video explaining it. There are some points to implement it. 1. Add android:fillViewport="true" in NestedScrollView This helps the child views fill the remaining space. 2. Set the views which moves smoothly according to gestures rather than treat the recycler vie..
val dir = File(requireContext().getExternalFilesDir(null).toString() + "/YOUR_DIRECTORY") dir.deleteRecursively() Just use File().deleteRecursively()
fun getUriFromByteArray(byteArray: ByteArray): Uri{ // Set directory val dir = File(requireContext().getExternalFilesDir(null).toString() + "/YOUR_DIR") if(! dir.exists()){ dir.mkdir() } // Create dummy file val file = if(url.endsWith(".mp4")){ File.createTempFile("post_media", ".mp4", dir) }else{ File.createTempFile("post_media", ".webm", dir) } // Write bytes to the file val os = FileOutputStr..
https://rccode.tistory.com/entry/Kotlin-Set-indent-to-first-line-of-TextView-in-android [Kotlin] Set indent to first line of TextView in android - Description To do so, you should use Span, LeadingMarginSpan. In a nutshell, Span is used to set text style in detail, and LeadingMarginSpan is one of the styles that is related to margin, espe.. rccode.tistory.com This post is advanced version of abo..
- Description To do so, you should use Span, LeadingMarginSpan. In a nutshell, Span is used to set text style in detail, and LeadingMarginSpan is one of the styles that is related to margin, especially can set margins of first and rest separately. First of all, initialize your span which will be assigned to textView. val spannable = SpannableString(yourTextView.text) And, define LeadingMarginSpa..
구현할 내용 구현 먼저 레이아웃은 아래와 같이 구성하였습니다. 1. 컨텐츠 텍스트와 "더보기" 텍스트가 세로로 붙어있는 구조입니다. 2. content에 maxLines, ellipsize를 설정하여, 글이 길어져서 maxLine를 넘어가면 글자 뒤에 "..."이 뜨게 하였습니다. 3. view_more는 더보기 텍스트이며 초기에는 보이지 않게 설정하였습니다. 다음은 context TextView에 적용할 코드입니다. 아래 함수를 onResume()에서 호출하였습니다. private fun setViewMore(contentTextView: TextView, viewMoreTextView: TextView){ // getEllipsisCount()을 통한 더보기 표시 및 구현 contentTextView..
As you see in title, I'd like to say that codes in this post is for POST request with empty body, which means ... body: {}. First of all, Set your api as below: interface YourApi { @POST("api/YOUR_ROUTE") fun yourFunction(@Body body: RequestBody): Call } } You will pass RequestBody in parameter. And the RequestBody is like as follows: val body = RequestBody.create(MediaType.parse("application/js..
val token = "###Your Token Here###" // Initialize Network Interceptor val networkInterceptor = Interceptor { chain -> val newRequest = chain.request().newBuilder() .addHeader("Authorization", "Bearer $token") .build() val response = chain.proceed(newRequest) response.newBuilder().build() } // Build OkHttpClient val client = OkHttpClient.Builder() .addNetworkInterceptor(networkInterceptor) .build..
정말 간단하다. setCustomCurrentLocationMarkerTrackingImage(int id, MapPOIItem.ImageOffset anchorPointOffset) 메소드 하나만 사용하면 된다. 예시는 아래와 같다. mapView.setCustomCurrentLocationMarkerTrackingImage(R.drawable.marker_current_location, MapPOIItem.ImageOffset(16, 16)) 다만, 여기서 알아야할 것이 두 가지 있다. - id에 해당하는 drawable id는, 비트맵 이미지의 id여야한다. 즉, png 같은 파일을 drawable에 넣고, 이것을 참조하여야 한다는 의미이다. - anchorPointOffset은 중점을 설정하는 부..