創(chuàng)建TV應(yīng)用Helloworld_第1頁
創(chuàng)建TV應(yīng)用Helloworld_第2頁
創(chuàng)建TV應(yīng)用Helloworld_第3頁
創(chuàng)建TV應(yīng)用Helloworld_第4頁
創(chuàng)建TV應(yīng)用Helloworld_第5頁
已閱讀5頁,還剩6頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、 TV apps use the same structure as those for phones and tablets. This similarity means you can modify your existing apps to also run on TV devices or create new apps based on what you already know about building apps for Android.電視應(yīng)用和手機(jī)以及平板使用相同的架構(gòu)。這樣就意味著我們可以修改現(xiàn)存的應(yīng)用到電視設(shè)備上或者創(chuàng)建新的應(yīng)用在電視上用類似于你所知的其他的構(gòu)建應(yīng)用程序

2、的方式Important: There are specific requirements your app must meet to qualify as an Android TV app on Google Play. For more information, see the requirements listed in TV App Quality.重點:想把android電視的應(yīng)用放在google play中要滿足一些得頂?shù)囊螅梢詤⒖糡v App Quality的列表This lesson describes how to prepare your development en

3、vironment for building TV apps, and the minimum required changes to enable an app to run on TV devices.本課程將描述如何準(zhǔn)備電視應(yīng)用的開發(fā)環(huán)境,最小的需求改變使得應(yīng)用運行中電視設(shè)備上See the following documentation for information about the codecs, protocols, and formats supported by Android TV. - Supported Media Formats - DRM - android.dr

4、m - ExoPlayer - android.media.MediaPlayer查看以下文檔信息,包括代碼,協(xié)議和Android TV支持的格式。Set up a TV Project創(chuàng)建TV項目This section discusses how to modify an existing app to run on TV devices, or create a new one. These are the main components you must use to create an app that runs on TV devices:這一部分將討論如何修改現(xiàn)存的應(yīng)用到電視上運

5、行,或者創(chuàng)建一個新的電視應(yīng)用。這些僵尸最主要的組建我們必須使用來創(chuàng)建一個電視應(yīng)用中電視設(shè)備上* Activity for TV (Required) - In your application manifest, declare an activity that is intended to run on TV devices. * TV Support Libraries (Optional) - There are several Support Libraries available for TV devices that provide widgets for building use

6、r interfaces. 電視活動(必須) - 在您的manifest中, 聲明一個可在TV設(shè)備上運行的activity。 電視支持庫(可選) - 這些支持庫Support Libraries 可以提供搭建TV用戶界面的控件。Prerequisites前提條件Before you begin building apps for TV, you must:在創(chuàng)建TV應(yīng)用前, 必須做以下事情:* Update your SDK tools to version 24.0.0 or higher The updated SDK tools enable you to build and test

7、apps for TV. 更新sdk工具版本到24或者以上,升級的sdk版本使得構(gòu)架電視測試應(yīng)用變的可用* Update your SDK with Android 5.0 (API 21) or higher The updated platform version provides new APIs for TV apps.更新你的sdk在android5.0或者以上,升級的平臺版本提供了新的電視應(yīng)用程序接口* Create or update your app project In order to access new APIs for TV devices, you must cre

8、ate a project or modify an existing project that targets Android 5.0 (API level 21) or higher.創(chuàng)建或者升級應(yīng)用程序項目來訪問新的電視應(yīng)用程序接口,必須創(chuàng)建或者修改現(xiàn)存的項目,版本這android5.0及其以上Declare a TV Activity聲明一個電視ActivityAn application intended to run on TV devices must declare a launcher activity for TV in its manifest using a CATEG

9、ORY_LEANBACK_LAUNCHER( intent filter. This filter identifies your app as being enabled for TV, and is required for your app to be considered a TV app in Google Play. Declaring this intent also identifies which activity in your app to launch when a user selects its icon on the TV home screen.想要一個應(yīng)用程序

10、運行中電視設(shè)備上必須聲明一個加載activity在manifest文件中使用intent filter包含CATEGORY_LEANBACK_LAUNCHER。這個過濾器說明你的應(yīng)用是在TV上可用,并且為Google Play上發(fā)布TV應(yīng)用所必須。定義這個intent也意味著點擊主屏幕的應(yīng)用圖標(biāo)時,就是打開的這個activity。The following code snippet shows how to include this intent filter in your manifest:接下來的代碼片段顯示如何在manifest中包含這個intent filter: . The sec

11、ond activity manifest entry in this example specifies that activity as the one to launch on a TV device.例子中第二個activity manifest定義的activity是TV設(shè)備中的一個啟動入口。 *Caution*: If you do not include the CATEGORY_LEANBACK_LAUNCHER( intent filter in your app, it is not visible to users running the Google Play stor

12、e on TV devices. Also, if your app does not have this filter when you load it onto a TV device using developer tools, the app does not appear in the TV user interface.Caution:如果在你的應(yīng)用中不包含CATEGORY_LEANBACK_LAUNCHER intent filter,它不會出現(xiàn)在TV設(shè)備的Google Play商店中。并且,即使你把不包含此filter的應(yīng)用用開發(fā)工具裝載到TV設(shè)備中,應(yīng)用仍然不會出現(xiàn)在TV用戶

13、界面上。If you are modifying an existing app for use on TV, your app should not use the same activity layout for TV that it does for phones and tablets. The user interface of your TV app (or TV portion of your existing app) should provide a simpler interface that can be easily navigated using a remote c

14、ontrol from a couch. For guidelines on designing an app for TV, see the TV Design( guide. For more information on the minimum implementation requirements for interface layouts on TV, see Building TV Layouts(如果你正在為TV設(shè)備修改現(xiàn)有的應(yīng)用,就不應(yīng)該與手機(jī)和平板用同樣的activity布局。TV的用戶界面(或者現(xiàn)有應(yīng)用的TV部分)應(yīng)該提供一個更簡單的界面,更容易坐在沙發(fā)上用遙控器操作。TV

15、應(yīng)用設(shè)計指南,參考電視設(shè)計指導(dǎo)。查看TV界面布局的最低要求,參考:電視布局# Declare Leanback support聲明Leanback支持Declare that your app uses the Leanback user interface required by Android TV. If you are developing an app that runs on mobile (phones, wearables, tablets, etc.) as well as Android TV, set the required attribute value to fal

16、se. If you set the required attribute value to true, your app will run only on devices that use the Leanback UI.Android TV需要你的應(yīng)用使用Leanback用戶界面。如果你正在開發(fā)一個運行在移動設(shè)備(手機(jī),可穿戴,平板等等)也包括TV的應(yīng)用,設(shè)置required屬性為false。因為如果設(shè)置為true,你的應(yīng)用將僅能運行在用Leanback UI的設(shè)備上。 .# Declare touchscreen not required聲明不需要觸屏Applications that

17、are intended to run on TV devices do not rely on touch screens for input. In order to make this clear, the manifest of your TV app must declare that a the android.hardware.touchscreen feature is not required. This setting identifies your app as being able to work on a TV device, and is required for

18、your app to be considered a TV app in Google Play. The following code example shows how to include this manifest declaration:運行在TV設(shè)備上的應(yīng)用不依靠觸屏去輸入。為了清楚表明這一點,TV應(yīng)用的manifest必須聲明android.hardware.touchscreen為不需要。這個設(shè)置表明應(yīng)用能夠工作在TV設(shè)備上,并且也是Google Play認(rèn)定你的應(yīng)用為TV應(yīng)用的要求。接下來的示例代碼展示這個manifest聲明: .*Caution*: You must d

19、eclare that a touch screen is not required in your app manifest, as shown this example code, or your app cannot appear in the Google Play store on TV devices.Caution:必須在manifest中聲明觸屏是不需要的,否則應(yīng)用不會出現(xiàn)在TV設(shè)備的Google Play商店中。# Provide a home screen banner提供一個主屏幕橫幅An application must provide a home screen ba

20、nner for each localization if it includes a Leanback launcher intent filter. The banner is the app launch point that appears on the home screen in the apps and games rows. Desribe the banner in the manifest as follows:如果應(yīng)用包含一個Leanback的intent filter,它必須提供每個語言的主屏幕橫幅。橫幅是出現(xiàn)在應(yīng)用和游戲欄的主屏的啟動點。在manifest中這樣描述橫

21、幅: .Use the android:banner attribute with the application tag to supply a default banner for all application activities, or with the activity tag to supply a banner for a specific activity.在應(yīng)用節(jié)點中添加banner屬性為所有的應(yīng)用activity提供默認(rèn)的橫幅,或者在特定activity的中添加橫幅。See Banners( in the UI Patterns for TV design guide.在

22、UI模式和TV設(shè)計指導(dǎo)中查看“旗幟”# Add TV Support Libraries添加TV支持庫The Android SDK includes support libraries that are intended for use with TV apps. These libraries provide APIs and user interface widgets for use on TV devices. The libraries are located in the /extras/android/support/ directory. Here is a list of

23、the libraries and their general purpose:Android SDK包含用于TV應(yīng)用的支持庫。這些庫為TV設(shè)備提供API和用戶界面控件。這些庫位于/extras/android/support/目錄。以下是這些庫的列表和它們的作用介紹:* v17 leanback library( - Provides user interface widgets for TV apps, particularly for apps that do media playback. * v7 recyclerview library( - Provides classes fo

24、r managing display of long lists in a memory efficient manner. Several classes in the v17 leanback library depend on the classes in this library. * v7 cardview library( - Provides user interface widgets for displaying information cards, such as media item pictures and descriptions. v17 leanback libr

25、ary - 提供TV應(yīng)用的用戶界面控件,特別是用于媒體播放應(yīng)用的控件。 v7 recyclerview library - 提供了內(nèi)存高效方式的長列表的管理顯示類。有一些v17 leanback庫的類依賴于本庫的類。 v7 cardview library - 提供顯示信息卡的用戶界面控件,如媒體圖片和描述。*Note*: You are not required to use these support libraries for your TV app. However, we strongly recommend using them, particularly for apps tha

26、t provide a media catalog browsing interface.Note:TV應(yīng)用中可以不用這些庫。但是,我們強(qiáng)烈推薦使用它們,特別是為應(yīng)用提供媒體目錄瀏覽界面時。If you decide to use the v17 leanback library for your app, you should note that it is dependent on the v4 support library( This means that apps that use the leanback support library should include all of

27、these support libraries:如果我們決定用v17 leanback library,我們應(yīng)該注意它依賴于v4支持庫。這意味著要用leanback支持庫必須包含以下所有的支持庫: v4 support library v7 recyclerview support library v17 leanback support libraryThe v17 leanback library contains resources, which require you to take specific steps to include it in app projects. For i

28、nstructions on importing a support library with resources, see Support Library Setup.v17 leanback library包含資源文件,需要你在應(yīng)用中采取特定的步驟去包含它。插入帶資源文件的支持庫的說明,查看支持庫安裝向?qū)? Build TV Apps創(chuàng)建TV應(yīng)用After you have completed the steps described above, its time to start building apps for the big screen! Check out these addi

29、tional topics to help you build your app for TV:在完成上面的步驟之后,到了給大屏幕創(chuàng)建應(yīng)用的時候了!檢查一下這些額外的專題可以幫助我們創(chuàng)建TV應(yīng)用:* Building TV Playback Apps( - TVs are built to entertain, so Android provides a set of user interface tools and widgets for building TV apps that play videos and music, and let users browse for the con

30、tent they want. * Helping Users Find Your Content on TV( - With all the content choices at users fingertips, helping them find content they enjoy is almost as important as providing that content. This training discusses how to surface your content on TV devices. * Games for TV( - TV devices are a gr

31、eat platform for games. See this topic for information on building great game experiences for TV. 創(chuàng)建電視播放應(yīng)用- TV就是用來娛樂的,因此安卓提供了一套用戶界面工具和控件,用來創(chuàng)建視頻和音樂的TV應(yīng)用,并且讓用戶瀏覽想看到的內(nèi)容。 幫助用戶找到電視內(nèi)容- 因為所有的內(nèi)容選擇都用手指操作遙控器,所以幫助用戶找到想要的內(nèi)容幾乎和提供內(nèi)容同樣重要。這個主題討論如何在TV設(shè)備中處理內(nèi)容。 電視游戲- TV設(shè)備是非常好的游戲平臺。參考這個主題去創(chuàng)造更好的TV游戲體驗。# Run TV Apps運行TV應(yīng)用Running your app is an important part of the development process. The AVD Manager in the Android SDK provides the device definitions that allow you to create virtual TV devices for running and testing your applications.運行應(yīng)用是在開發(fā)過程中的一個重要

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論