天气预报主界面--main_interaface.xml
来源:互联网 发布:mac onedrive 打不开 编辑:程序博客网 时间:2024/06/06 09:09
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/mainId" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background1" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:layout_marginTop="10dp" android:layout_weight="4.3"> <TextView android:id="@+id/cityName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="50sp" /> <ImageView android:id="@+id/queryNowWeather" android:layout_width="39dp" android:layout_height="46dp" android:cacheColorHint="#00000000" android:src="@drawable/location_up_and_down" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:layout_marginLeft="50sp" android:textSize="13sp"/> <TextView android:id="@+id/weeks" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:layout_marginLeft="50sp" android:textSize="13sp" /> </LinearLayout> </LinearLayout> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:layout_weight="3.9" > <TextView android:id="@+id/weather" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:layout_marginTop="20sp" android:textSize="20sp" /> <ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginRight="30dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" " /> <TextView android:id="@+id/temperature" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="20sp" android:layout_below="@id/weather"/></RelativeLayout><LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:layout_weight="4.7" > <TextView android:id="@+id/index" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="18sp"/> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:layout_weight="4"> <LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="match_parent" android:background="@drawable/boder" android:gravity="center_horizontal" android:layout_weight="0.50"> <TextView android:id="@+id/tomorrow_week" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="13sp"/> <TextView android:id="@+id/tomorrow_weather" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="13sp"/> <ImageView android:id="@+id/tomorrow_image" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:background="@drawable/boder" android:orientation="vertical" android:gravity="center_horizontal" android:layout_weight="0.50" > <TextView android:id="@+id/after_tomorrow_week" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="13sp"/> <TextView android:id="@+id/after_tomorrow_weather" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="13sp"/> <ImageView android:id="@+id/after_tomorrow_image" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:gravity="bottom" android:layout_weight="4.1"> <Button android:id="@+id/queryGuangzhou" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:background="@drawable/maininterface_button_up_and_down" android:text="@string/queryGuangzhou" /> <Button android:id="@+id/history" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/maininterface_button_up_and_down" android:text="@string/history" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginBottom="5dp" > <Button android:id="@+id/queryOther" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:background="@drawable/maininterface_button_up_and_down" android:text="@string/queryOther" /> <Button android:id="@+id/alarm" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="20dp" android:background="@drawable/maininterface_button_up_and_down" android:text="@string/alarm" /> <Button android:id="@+id/share" android:layout_width="34dp" android:layout_height="39dp" android:layout_marginLeft="38dp" android:background="@drawable/share_up_and_down" /> </LinearLayout></LinearLayout> </LinearLayout>
</pre><pre name="code" class="html">
界面如图。
这个界面有点复杂,嵌套了太多LinearLayout,为了适应各种分辨率手机,分别用了5个LinearLayout来包住所有的控件,然后在这5个LinearLayout中设置各自的权重,效果就是这样。
左下角的Button设置了Background,用了一个selector来实现Button按下和normal的效果
<?xml version="1.0" encoding="utf-8" ?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 触摸模式下单击时的背景图片--> <item android:state_pressed="true" android:drawable="@drawable/maininterface_button_down" /> <!--选中时的图片背景--> <item android:state_pressed="false" android:drawable="@drawable/maininterface_button_up" /> </selector>
</pre><pre name="code" class="html">
1 0
- 天气预报主界面--main_interaface.xml
- 天气预报界面
- android 天气预报 界面
- 仿天气预报界面
- 安卓中xml解析天气预报
- 利用dom4j解析xml--天气预报
- jQuery访问xml文件显示天气预报
- 基于Json和Xml的天气预报
- 天气预报XML格式城市信息解析
- 天气预报系统——XML应用
- 读取xml格式的天气预报的代码
- 天气预报
- 天气预报
- 天气预报
- 天气预报
- 天气预报
- 天气预报
- 天气预报
- Android app 天气预报简介及要求功能实现
- 2014年辛星jquery解读第一节
- 我对博客的一点看法
- 7.22
- VirtualBox 扩展虚拟硬盘
- 天气预报主界面--main_interaface.xml
- 天气预报功能--查询广州天气的实现
- 2014年辛星jquery解读第二节
- 接口隔离原则
- 男孩卡在车窗上离奇身亡 停放不当车主要赔14万
- 2014年辛星jquery解读第三节 Ajax
- LeetCode 80. Remove Duplicates from Sorted Array II
- ELMAH and API controller in MVC4 not logging errors
- 映像记忆表3