public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LayoutInflater inflater = AsyncLayoutInflater.from(this); inflater.inflate(R.layout.async_layout, null, new AsyncLayoutInflater.OnInflateFinishedListener() { @Override public void onInflateFinished(@NonNull View view, int resid, @Nullable ViewGroup parent) { TextView textView = view.findViewById(R.id.async_textview); ViewGroup container = findViewById(R.id.async_container); container.addView(view); } }); } } groovy dependencies { implementation 'androidx.asynclayoutinflater:asynclayoutinflater:1.0.0' }


上一篇:
下一篇:
切换中文