简体   繁体   English

具有相应图片和文字的多页应用程序

[英]Multi-page application with corresponding pictures and text

I'm new to Java and Android. 我是Java和Android的新手。 I have been trying for the past week to make an app for my phone. 在过去的一周中,我一直在努力为手机制作应用程序。 The app consists of 4 pages, which are diagrammed below: 该应用程序包括4页,如下图所示:

解释四页的图

  • Page 1: Contains a picture taking up the size of the screen. 第1页:包含一张占用屏幕大小的图片。 If I click on the picture it needs to go to "page 2". 如果我单击图片,则需要转到“第2页”。

  • Page 2: Consists of an icon on the left (say the flag for instance) followed by a text field (eg. USA). 第2页:由左侧的图标(例如标记)组成,后跟文本字段(例如,USA)。 When "USA" strip is clicked it needs to go to page 3. 单击“美国”条时,需要转到第3页。

  • Page 3: Consists of text, picture and then more text from a string. 第3页:包含文本,图片,然后是字符串中的更多文本。 This page needs to correspond to the strip clicked on in page 2 ("USA" in this example). 该页面需要与第2页中单击的条相对应(在此示例中为“ USA”)。 There are also two buttons at the bottom of "page 3" and "page 4" which when pressed need to go to the corresponding page numbers. 在“第3页”和“第4页”的底部还有两个按钮,按下时需要转到相应的页码。

  • Page 4: This page is displayed if the "More" button is pressed on "page 3". 第4页:如果在“第3页”上按下“更多”按钮,则显示此页面。

I would like this phone to work on a minimum Android 2.2 or 2.3. 我希望这款手机至少可以在Android 2.2或2.3上运行。 All logos, pictures and string texts need to be locally available (resources folder) and not website based. 所有徽标,图片和字符串文本都必须在本地可用(资源文件夹),而不是基于网站的。 I have tried all sorts of combinations of ListView 's and buttons with OnClickListener 's as well as toast screens. 我尝试了ListView和按钮与OnClickListener和吐司屏幕的各种组合。 My limited knowledge of programming is frustrating. 我有限的编程知识令人沮丧。

My question is if there is a template around which will help me out with this app? 我的问题是周围是否有模板可以帮助我解决这个问题? Or if there are any web resources. 或者,如果有任何网络资源。

In Android, individual "pages" or "screens" can be implemented as Activity s. 在Android中,可以将单个“页面”或“屏幕”实现为Activity You need to extend the Activity class and add the components that you wish to display. 您需要扩展Activity类并添加要显示的组件。 Most of the layout can be done in an XML file. 大多数布局可以在XML文件中完成。 I strongly suggest that you google for a tutorial that illustrates the basics of Android programming. 我强烈建议您在Google上搜索说明Android编程基础的教程。 From there, you can start by creating an app with two pages. 从那里开始,您可以创建一个包含两个页面的应用程序。 And then just keep adding a little bit at a time until you get the complete app that you want. 然后只需一次添加一点,直到获得所需的完整应用程序。

There some easy ways to do this. 有一些简单的方法可以做到这一点。 If you want to be backwards compatible to SDK 8 you can do this in two ways. 如果要向后兼容SDK 8,可以采用两种方法。 You can use Fragments or Activities for each layout. 您可以为每个布局使用片段或活动。 If you implement fragments, I suggest reading http://developer.android.com/guide/components/fragments.html inside there you will about using the FragmentActivity instead of the Activity. 如果您实现片段,建议您在其中阅读http://developer.android.com/guide/components/fragments.html ,其中有关使用FragmentActivity而不是Activity。 Read this link http://developer.android.com/tools/extras/support-library.html as it will have the needed libraries to implement the Fragments in older versions of the SDK. 阅读此链接http://developer.android.com/tools/extras/support-library.html ,因为它将具有在旧版SDK中实现Fragments所需的库。 It does looks like you looking for some navigation buttons that reside on the bottom of the layout. 它看起来确实像您在寻找位于布局底部的一些导航按钮。 In order to fully implement a layout that has this view on the bottom of the screen in SDK 8, you will need to create your own View and place it on the bottom of the screen. 为了完全实现在SDK 8的屏幕底部具有此视图的布局,您需要创建自己的视图并将其放置在屏幕底部。 RelativeLayout and alignParentBottom = "true" will accomplish this. RelativeLayout和alignParentBottom =“ true”将完成此操作。 There is also a way to do this using a ViewPager which will also work in the backwards compatibility requirements you have. 还有一种使用ViewPager进行此操作的方法,该方法也可以满足您的向后兼容性要求。 I am sorry the amount of information I am throwing at you but I really would recommend looking into other questions posted by users on this topic. 很抱歉,我要向您提供大量信息,但我真的建议您调查用户发布的有关此主题的其他问题。 How to navigate to another page in android? 如何导航到Android中的另一个页面? for example. 例如。 Good luck and everything you are looking for is able to be learned through a Google search. 祝您好运,您所寻找的一切都可以通过Google搜索来了解。 Maybe not all at once. 也许不是一次全部。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM