android自学 app天气预报系统

Android实战开发--天气预报App_哔哩哔哩_bilibili

git地址: GitHub - CodePpoi/WeatherForcast

比较难的是pagerAdapter和Fragment的使用,而且百度的天气地址已经不顶用了,作者用的是juhe的天气地址,然而juhe也不顶用了,参考别人的git,用的qq天气

如果要对某些展示采用统一风格,可参考

<TextView
                android:id="@+id/frag_tv_temprange"
                style="@style/todaytext"
                android:text="9~-1℃"
                android:layout_toRightOf="@id/frag_tv_line1"
                android:layout_alignBottom="@id/frag_tv_wind"/>

 <TextView
                    android:id="@+id/frag_index_tv_air"
                    style="@style/indextext"
                    android:text="空调指数"
                    android:drawablePadding="10dp"
                    android:drawableBottom="@mipmap/icon_air"/>
 

其中 style todaytext和indextext定义如下

<style name="todaytext" >
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textSize">18sp</item>
        <item name="android:textStyle">bold</item>
    </style>

    <style name="indextext">
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_weight">1</item>
        <item name="android:textSize">16sp</item>
        <item name="android:textStyle">bold</item>
        <item name="android:drawablePadding">5dp</item>
        <item name="android:gravity">center</item>
    </style>

其中drawableBottom 表示当前mipmap的图像在"空调指数"这个文字的底部,类似的有drawableLeft

而android:drawablePadding="10dp"表示图像和文字之间间隔要10dp,因为是上下排列的,所以上下两者间隔10dp

android:layout_toRightOf="@id/frag_tv_wind"

这里的toRightOf也类似于drawableRight,不过是文字的布局,而不是图片的布局

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值