[안드로이드 스튜디오/코틀린] 가이드 라인
Guideline (Horizontal, Vertical)
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.45" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.68" />
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity.kt
package com.shinyelee.android_study2
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.SearchView
import com.shinyelee.android_study2.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
private var vBinding : ActivityMainBinding? = null
private val binding get() = vBinding!!
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
vBinding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
}
override fun onDestroy() {
vBinding = null
super.onDestroy()
}
}
참고
반응형
'개발(Android) > android studio' 카테고리의 다른 글
[Android Studio/Kotlin] Vibration, Push Notification (0) | 2022.05.17 |
---|---|
[Android Studio/Kotlin] Tool Bar (0) | 2022.05.12 |
[Android Studio/Kotlin] Search View, Spinner (0) | 2022.05.10 |
[Android Studio/Kotlin] Seek Bar, Rating Bar (0) | 2022.05.10 |
[Android Studio/Kotlin] Progress Bar (0) | 2022.05.09 |