根据视图创建动态页脚的最佳方法,android
我正在创建一个应用程序。在应用程序的每个屏幕中,我都必须添加页脚。如果方向更改为横向,则不应有页脚,否则应有页脚。在该页脚中应该有三个按钮。如果我在第一页,则第一页将被选中,如果我在第二页,则应选择第二个按钮。我想要这种类型的功能。为了实现这一点,我可以创建一个页脚布局并添加到每个屏幕的xml中,但我想根据页面选择按钮,并隐藏或显示页脚关于方向。我怎样才能实现这个目标?
谢谢 苏尼尔
I am creating an application. in every screen of the application I have to add footer. If the orientation change to landscape then there should be no footer otherwise there should be footer. in that footer there should be three buttons. if i am in first page then first page will be in selected if i am in second page then second button should be selected. I want this type of functionality. To achieve this i can create a footer layout and add in the xml of every screen but i want to select the buttons depending on the page and also hide or show the footer depending on the orientation. How can I achieve this?
Thanks
Sunil
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了处理显示/隐藏页脚,我在
onCreate
方法的末尾执行此操作:if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
footer.setVisibility(View.GONE);
为了处理显示/隐藏页脚,
To deal with showing/hiding the footer I do this at the end of my
onCreate
method:if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
footer.setVisibility(View.GONE);
}
To deal with selecting the button just add a line of code that selects the appropriate button based on the activity.