1.1.18.5. fejezet, Binding
Beküldte pzoli - 2024, május 1 - 12:35du
build.gradle.kts (Module:app)
android { ... buildFeatures { viewBinding = true } ... }
MainActivity.kt
class MainActivity : AppCompatActivity() { private lateinit var binding: ActivityMainBinding override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) } }
MainActivity.java
public class MainActivity extends AppCompatActivity { ActivityMainBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = ActivityMainBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); } }
- A hozzászóláshoz be kell jelentkezni