#趣米杯 # code farming weather--code farmers own weather App (iv)

Source: Internet
Author: User
This article participates in the Interest Rice Cup essay activity, if needs to reprint please indicate the source and the author


#趣米杯 # code farming weather--The Weather app (i)
#趣米杯 # code farming weather--The Weather app (ii)
#趣米杯 # code farming weather--code farmers Own weather App (iii)

We've already implemented a basic feature of the weather app, and I'm going to introduce a couple of features to the app: Notice bar, Desktop widget, and PM2.5 that people are really concerned about lately.
First of all, simple to say the implementation of the notice bar, this function is very simple, as long as you have the layout of the file design, and then through the Notificationmanager show it can, the cancellation is also through the Notificationmanager to cancel, This piece should not have any difficulty, I put my reverse solution of the Rainbow Weather Notice column layout file, we draw on:

<?xml version= "1.0" encoding= "UTF-8"?>
<relativelayout xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:id= "@+id/widgetrl"
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:layout_margin= "0.0dip" >

<textview
Android:id= "@+id/citytv"
Style= "\ @style/notificationtitle"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_alignparentleft= "true"
android:layout_marginleft= "8.0dip"
android:layout_margintop= "2.0dip"
Android:textsize= "16.0dip"
android:textstyle= "Bold"/>

<textview
Android:id= "@+id/todaytempnow"
Style= "\ @style/notificationtext"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_below= "@id/citytv"
android:layout_marginleft= "15.0dip"
android:layout_margintop= " -4.0dip"
Android:textsize= "22.0dip"/>

<linearlayout
Android:id= "@+id/days"
Android:layout_width= "195.0dip"
android:layout_height= "Wrap_content"
Android:layout_alignparentright= "true"
Android:layout_centervertical= "true"
android:orientation= "Horizontal" >

<linearlayout
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
Android:layout_weight= "2.0"
Android:gravity= "Center_horizontal"
android:orientation= "Vertical" >

<textview
Android:id= "@+id/tvday1"
Style= "\ @style/notificationtext"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
android:gravity= "Center"
Android:textsize= "10.0dip"/>

<imageview
Android:id= "@+id/imgicon1"
Android:layout_width= "32.0dip"
android:layout_height= "32.0dip"
Android:padding= "3.0dip"
Android:scaletype= "Fitxy"/>

<textview
Android:id= "@+id/tvtemp1"
Style= "\ @style/notificationtext"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:textsize= "10.0dip"/>
</LinearLayout>

<linearlayout
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
Android:layout_weight= "2.0"
Android:gravity= "Center_horizontal"
android:orientation= "Vertical"
android:paddingleft= "2.0dip"
android:paddingright= "2.0dip" >

<textview
Android:id= "@+id/tvday2"
Style= "\ @style/notificationtext"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
android:gravity= "Center"
Android:textsize= "10.0dip"/>

<imageview
Android:id= "@+id/imgicon2"
Android:layout_width= "32.0dip"
android:layout_height= "32.0dip"
Android:padding= "3.0dip"
Android:scaletype= "Fitxy"/>

<textview
Android:id= "@+id/tvtemp2"
Style= "\ @style/notificationtext"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:textsize= "10.0dip"/>
</LinearLayout>

<linearlayout
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
Android:layout_weight= "2.0"
Android:gravity= "Center_horizontal"
android:orientation= "Vertical" >

<textview
Android:id= "@+id/tvday3"
Style= "\ @style/notificationtext"
Android:layout_width= "Fill_parent"
android:layout_height= "Wrap_content"
android:gravity= "Center"
Android:textsize= "10.0dip"/>

<imageview
Android:id= "@+id/imgicon3"
Android:layout_width= "32.0dip"
android:layout_height= "32.0dip"
Android:padding= "3.0dip&q

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.