Android新闻客户端开发1--UI设计(主界面)

基于Android的小巫新闻客户端开发--UI设计(主界面)

2013年2月15日

由于太多事情要乱,不可能只专注一样东西,因为怕完成不了任务。原本这系列博客就是要在寒假搞定的,没想到拖了那么久,没办法。现在只能有空的时候就回顾一下小巫新闻客户端,在复习一下这样子了。大概会在10篇以内把整个客户端开发给写完,不可能面面俱到的了,只是把核心的东西,稍微总结一下,回顾一下。

 

关于这个新闻客户端的开发,小巫是从设计界面开始的,简单的来说就是搭建框架,把整体的框架建好了,剩下的就是业务逻辑的实现了。那好,这篇用来介绍主界面的设计过程。

首先看看最初想实现的效果和最终实现的效果:

      

 

光看效果图,我们都大致能想到用什么布局来实现上面的效果。光用语言来描述,总是欠缺想象力的,还是先帖代码,再介绍。

 

  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  2.     xmlns:tools="http://schemas.android.com/tools"  
  3.     android:id="@id/main_layout"  
  4.     android:layout_width="match_parent"  
  5.     android:layout_height="wrap_content"  
  6.     android:background="@drawable/main_background"  
  7.     android:orientation="vertical" >  
  8.   
  9.     <RelativeLayout  
  10.         android:id="@id/titlebar_layout"  
  11.         android:layout_width="match_parent"  
  12.         android:layout_height="wrap_content"  
  13.         android:background="@drawable/image_titlebar_background" >  
  14.   
  15.         <TextView  
  16.             android:layout_width="wrap_content"  
  17.             android:layout_height="wrap_content"  
  18.             android:layout_marginLeft="10.0dip"  
  19.             android:layout_marginTop="9.0dip"  
  20.             android:text="@string/app_name"  
  21.             android:textColor="@color/white"  
  22.             android:textSize="23.0sp" />  
  23.   
  24.         <Button  
  25.             android:id="@id/titlebar_refresh"  
  26.             android:layout_width="wrap_content"  
  27.             android:layout_height="wrap_content"  
  28.             android:layout_alignParentRight="true"  
  29.             android:layout_marginRight="5.0dip"  
  30.             android:layout_marginTop="6.0dip"  
  31.             android:background="@drawable/btn_titlebar_refresh_selector" />  
  32.   
  33.         <ProgressBar  
  34.             android:id="@id/titlebar_progress"  
  35.             style="?android:attr/progressBarStyleLarge"  
  36.             android:layout_width="25.0dip"  
  37.             android:layout_height="25.0dip"  
  38.             android:layout_alignParentRight="true"  
  39.             android:layout_marginRight="14.0dip"  
  40.             android:layout_marginTop="10.0dip"  
  41.             android:clickable="false"  
  42.             android:visibility="gone" />  
  43.     </RelativeLayout>  
  44.   
  45.     <RelativeLayout  
  46.         android:id="@id/categorybar_layout"  
  47.         android:layout_width="match_parent"  
  48.         android:layout_height="wrap_content"  
  49.         android:layout_marginTop="-16dip"  
  50.         android:background="@drawable/image_categorybar_background" >  
  51.   
  52.         <Button  
  53.             android:id="@id/category_arrow_right"  
  54.             android:layout_width="6.0dip"  
  55.             android:layout_height="10.0dip"  
  56.             android:layout_alignParentRight="true"  
  57.             android:layout_marginRight="12dip"  
  58.             android:layout_marginTop="17dip"  
  59.             android:background="@drawable/image_categorybar_right_arrow" />  
  60.   
  61.         <HorizontalScrollView  
  62.             android:id="@id/categorybar_scrollView"  
  63.             android:layout_width="match_parent"  
  64.             android:layout_height="wrap_content"  
  65.             android:layout_marginLeft="8dip"  
  66.             android:layout_marginTop="3.0dip"  
  67.             android:layout_toLeftOf="@+id/category_arrow_right"  
  68.             android:scrollbars="none" >  
  69.   
  70.             <LinearLayout  
  71.                 android:id="@id/category_layout"  
  72.                 android:layout_width="wrap_content"  
  73.                 android:layout_height="match_parent"  
  74.                 android:gravity="center_vertical" >  
  75.             </LinearLayout>  
  76.         </HorizontalScrollView>  
  77.     </RelativeLayout>  
  78.   
  79.   
  80.     <ListView  
  81.         android:id="@id/news_list"  
  82.         android:layout_width="match_parent"  
  83.         android:layout_height="match_parent"  
  84.         android:cacheColorHint="#00000000"  
  85.         android:divider="@drawable/image_list_separator_line"  
  86.         android:fastScrollEnabled="true"  
  87.         android:listSelector="@drawable/news_list_item_selector" />  
  88.   
  89. </LinearLayout>  


以上代码就是该效果图的xml代码,可以知道最外层的布局是用线性布局的(LinearLayout),其中嵌套了两个相对布局(RelativeLayout),最后是一个ListView组件;整个界面的布局设计就这么简单,第一个RelativeLayout是标题栏的布局,其中有一个TextView和一个刷新按钮;第二个RelativeLayout是分类栏的布局,这个稍微复杂一点,有一个Button组件,还有HorizontalScrollView.具体代码请读者自行查看。其中还有一些细节,比如说背景,还有一下效果。需要读者自己去体会才能了解清楚。在这里也无法说得太明白。


原:http://blog.csdn.net/wwj_748/article/details/8581906


安卓课程设计随着着信息技术的高速成长,尤其是移动通讯技术和网络技术, 在获得讯息的技术措施方面产生了许多的变化,尤其是那些对达到及时讯息请求强烈、移动性强的人们,移动计算和无线数据技术将会给他们的工作带来新的变化。智能手机和平板电脑的普及,智能手机和平板电脑的需求逐年增加。Android操作系统在移动终端设备市场发展迅速,成为要支柱。 跟着当今社会的迅速成长,互联网已走进千家万户,而手机也渐渐成为了咋们日常生活中不可或缺的配置,跟着3g、4g的到来,手机互联网也从开始的打电话,发送短信,并慢慢升级到聊天、阅读新闻、观看视频、在线购物等。在一定程度上,未来的发展趋势也和手机密切相关,在今天的互联网的飞速发展,移动应用如雨后春笋般崛起,在我们的生活中产生了巨大的影响,所有的应用程序,QQ的出现,使我们可以与朋友和家人更方便,各种新闻客户端,如网易新闻,今天的头条新闻出现,使我们不出去,而且还通过应用程序来了解新闻。各类新闻客户端如网易新闻、今日头条的出现,使我们不出门也可以通过app获取各地的新闻。本次设计的任务就是设计一个新闻APP软件,利用这款app方便用户在第一时间掌握社交动态。本系统采用Android开源系统技术,利用Java语言和Android Studio开发环境进行开发。该项目函盖Android开发领域的四大组件、Material Design设计等技术。 头条新闻系统采用Material Design设计风格,用户界面美观、用户页面友好,操作方便。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值