DBILITY

독거 가능성 100% 노후에 라면값이라도 하게 센스를 발휘합시다!😅
Please click on the ad so that I can pay for ramen in my old age!
点击一下广告,让老后吃个泡面钱吧!
老後にラーメン代だけでもするように広告を一回クリックしてください。

android include viewBinding 본문

android

android include viewBinding

DBILITY 2024. 4. 12. 10:31
반응형

보통하는 Activity에서 하는 것처럼 필요한 Activity에서 하면 된다.

toolbar Layout을 만들고 그걸 Activity에서 include

class MainActivity : AppCompatActivity() {

    private val binding by lazy {
        ActivityMainBinding.inflate(layoutInflater)
    }
    private val bindingToolbar by lazy {
        ToolbarLayoutBinding.inflate(layoutInflater)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //enableEdgeToEdge()
        setContentView(binding.root)
        /*ViewCompat.setOnApplyWindowInsetsListener(binding.drawerLayout) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }*/

        setSupportActionBar(bindingToolbar.toolbar)

    }
}

 

반응형

'android' 카테고리의 다른 글

Didn't find class "androidx.core.app.CoreComponentFactory"  (0) 2024.04.16
AVD network speed  (0) 2024.04.15
android dark mode 비활성화  (0) 2024.04.04
android external library register  (0) 2024.04.02
android retrofit2  (0) 2024.04.01
Comments