简体   繁体   English

如何从JAVA检查android中是否包含特定的布局?

[英]how do I check if a particular Layout is included in android from JAVA?

I would like to do the following: 我要执行以下操作:

setContentView(R.layout.product_details_editpage);

I want to check if product_details_editpage layout has another layout included in it? 我要检查product_details_editpage布局是否包含其他布局? If so, for the included layout components, I would like to reuse the handlers from elsewhere in the App. 如果是这样,对于包含的布局组件,我想重用App中其他位置的处理程序。

If the included layout has a button such as Logout, then I dont want to re-implement that logout button handler again in th eactivity that sets calls setContentView() above. 如果所包含的布局具有诸如Logout之类的按钮,那么我不想在设置上述setContentView()调用的活动中再次重新实现该Logout按钮处理程序。

What is the easiest way /best way to do this? 最简单的方法/最佳方法是什么?

agreed with above comments. 同意以上评论。 accept te discussion is closed. 接受讨论已关闭。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在NDK中使用随附的Android依赖项? - How do I use included Android dependencies from within the NDK? Java Android BaseAdapter-如何从适配器的特定位置在TextView中设置Text? - Java android BaseAdapter - how do I setText in a TextView at particular position from adapter? Android Studio Java:如何将约束布局的背景设置为来自 URL 的图像? - Android Studio Java: How do I set the background of a constraint layout to be an image from a URL? 如何访问代码中包含的布局? - How do i access a included layout in my code? 如何使用 android 合成的 kotlin 从包含的布局访问视图 - How to access view from included layout with kotlin synthetic in android 如何检查特定对象的Android等级栏是否为空? 空检查似乎不起作用 - How do I check if the Android rating bar is empty for a particular object? The null check doesnt seem to working 如何将图像保存在存储特定文件夹(图库)中并使用 java 从 android 11 以上或以下的存储中获取图像? - How do I save images in storage particular folder (gallery) & Get image from storage in above android 11 or below with java? 如何从Android中包含的第三方库中删除未使用的资源? - How do I remove unused resources from third-party libraries I’ve included on Android? 如何在Android中从布局XML设置WebView的URL? - How do I set URL for WebView from layout XML in Android? 如何将包含的 xml 布局更改为 Java 代码上的另一个布局? - How can i change included xml layout to another layout on java code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM