在我们的上一篇博客中,我们介绍了首页中的app列表界面怎样完毕。这个ListView以及其Adapter会在我们后面的界面中重用,所以这个是比較重要的,在这一篇博客中,我们先完毕app具体介绍界面的一部分,当我们点击ListView的每个item的时候,会进入我们这个界面进行app的具体介绍。

我们先来看一下效果图。

这个小界面还是比較简单的。

首先我们先要完毕上面的一个导航栏,当中包含左面的箭头和中间的文字以及颜色。

我们在res/layout目录以下创建一个新的文件。命名为activity_app_detail.xml

我们先来看一下上面的导航栏的代码:


<RelativeLayout
android:id="@+id/rl_app_detail_title"
android:layout_width="fill_parent"
android:layout_height="@dimen/bar_height"
android:layout_alignParentTop="true"
android:background="@color/mbarcolor" > <TextView
android:id="@+id/tv_app_detail_back"
android:layout_width="@dimen/bake_size"
android:layout_height="@dimen/bake_size"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:background="@drawable/button_back"
android:clickable="true"
android:gravity="center" /> <TextView
android:id="@+id/tv_app_detail_appName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:text="详情"
android:textColor="@color/white"
android:textSize="24sp"
android:textStyle="bold" />
</RelativeLayout>

以下我们看一下,颜色mbarcolor的定义,该颜色定义在res/color/color.xml 文件里。代码例如以下:

<color name="mbarcolor">#29abe2</color>

以下我们来定义后面的那个显示app图片和其它信息的显示界面。我们在文件activity_app_detail.xml文件里接着续上后面的代码:


<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/rl_app_detail_title" > <RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" > <RelativeLayout
android:id="@+id/rl_general"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/mbarcolor" > <ImageView
android:id="@+id/iv_app_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/icon4" /> <RelativeLayout
android:id="@+id/rl_tv_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dip"
android:layout_marginTop="5dp"
android:layout_toRightOf="@+id/iv_app_icon" > <TextView
android:id="@+id/tv_app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="酷我音乐"
android:textColor="@color/white"
android:textSize="18sp" /> <LinearLayout
android:id="@+id/ll_rank"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_app_name"
android:layout_marginTop="3dp"
android:orientation="horizontal" > <ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:background="@drawable/star_on" /> <ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:background="@drawable/star_on" /> <ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:background="@drawable/star_on" /> <ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:background="@drawable/star_on" /> <ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:background="@drawable/star_off" />
</LinearLayout> <RelativeLayout
android:id="@+id/rl_down_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/ll_rank"
android:layout_marginTop="3dp" > <TextView
android:id="@+id/tv_app_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="18.92M"
android:textColor="@color/white"
android:textSize="12sp" >
</TextView> <TextView
android:id="@+id/tv_down_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_toRightOf="@id/tv_app_size"
android:text="57288次下载"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
</RelativeLayout> <View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@id/iv_app_icon"
android:layout_marginTop="5dp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>

在这里我们定义成ScrollView,由于在后面还有非常多内容须要加入。

好了,这里我们就定义好我们的界面了,接着。我们创建一个Activity来显示该界面,以及为首页上的ListView加入监听来跳转到这个界面中来。

在src/com.sdu.activities中创建AppDetailInfoActivity,继承自BaseActivity.


package com.sdu.activities; import com.sdu.androidmarket.R; import android.view.View;
import android.view.Window;
import android.widget.TextView; public class AppDetailInfoActivity extends BaseActivity { private TextView tv_app_detail_back; @Override
public void initWidget() {
// TODO Auto-generated method stub requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_app_detail); tv_app_detail_back = (TextView)findViewById(R.id.tv_app_detail_back);
tv_app_detail_back.setOnClickListener(this); } @Override
public void widgetClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.tv_app_detail_back:
AppDetailInfoActivity.this.finish();
break;
}
} }

接下来,我们来看一下HomeActivity中ListView的监听。


lv_apps.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override
public void onItemClick(AdapterView<? > parent, View view,
int position, long id) {
// TODO Auto-generated method stub
Intent intent = new Intent(HomeActivity.this,AppDetailInfoActivity.class);
startActivity(intent);
}
});

好了,这样总体的工作就完毕了。对了。千万不要忘记在AndroidManifest.xml中注冊该Activity。


<activity android:name="com.sdu.activities.AppDetailInfoActivity" >
</activity>

这样,这个小界面就完毕了,大家自己完毕一下。看一下吧。在以下的文章中,我们继续完毕我们的app具体界面的介绍。

app具体介绍界面-01的更多相关文章

  1. 【app】Appium-desktop界面介绍

    在appium主界面的host输入127.0.0.1 然后点击Start Server即可开启appium server 我们来说说advanced选项 Server Address: 为appium ...

  2. Xamarin.iOS - 利用Settings插件与EAIntroView制作App的欢迎界面

    Xamarin.iOS - 利用Settings插件与EAIntroView制作App的欢迎界面 关于欢迎界面 很多App第一次启动都会有一个欢迎界面,欢迎界面往往决定这用户对App的第一映像,所以欢 ...

  3. App自动化测试-1.App自动化介绍和环境搭建

    App自动化测试-1.App自动化介绍和环境搭建 *:first-child { margin-top: 0 !important; } body>*:last-child { margin-b ...

  4. app让个别界面横屏,其他的为竖屏,解决如下

    app让个别界面横屏,其他的为竖屏,解决如下 APP设置里面,一定要设置可以旋转的方向 appdelegate里面重新系统方向代理 func application(application: UIAp ...

  5. 飞达资讯App总体介绍及关系架构图

    飞达资讯App总体介绍: 下图为飞达资讯App的关系架构图: 该App关系架构图所需的图片云盘链接地址:http://pan.baidu.com/s/1gfHIe4b 提取密码:x1nr 该App的云 ...

  6. [原创]互联网金融App测试介绍

    [原创]互联网金融App测试介绍 前端时间非常忙,终于非常忙的时间过去了,抽时间总结下我现在所在公司理财软件App测试,也各位分享下,也欢迎大家提建议,谢谢! 先介绍下我所在公司的产品特点,公司所研发 ...

  7. iOS 6 的 Smart App Banners 介绍和使用

    iOS 6 的 Smart App Banners 介绍和使用 Denis 留言: 10 浏览:4890 文章目录[隐藏] 什么是 Smart App Banners 在你的网站添加 Smart Ap ...

  8. Android学习笔记-App初始启动界面实现

    android手机上的很多应用程序启动时都会先显示一个图片,作为该应用程序的开始,该图片转瞬即逝.这个图片一般都会用应用的图标,作为广告来用. 例如: 它的实现方式很简单,我们以一个测试APP为例,介 ...

  9. 用Vue.js开发一个电影App的前端界面

    我们要构建一个什么样的App? 我们大多数人使用在线流媒体服务(如Netflix)观看我们最喜欢的电影或者节目.这篇文章将重点介绍如何通过使用vue.js 2 建立一个类似风格的电影流媒体WEB交互界 ...

随机推荐

  1. gnu printf可变参数宏

    可变参数的宏 标准C只支持可变参数的函数,意味着函数的参数可以是不固定的 例如printf()函数的原型是int printf(const char *format [,argument]...) 而 ...

  2. LeetCode(72) Edit Distance

    题目 Given two words word1 and word2, find the minimum number of steps required to convert word1 to wo ...

  3. js中的事件委托或事件代理

    一,概述 JavaScript高级程序设计上讲:事件委托就是利用事件冒泡,只指定一个事件处理程序,就可以管理某一类型的所有事件. 举一个网上大牛们讲事件委托都会举的例子:就是取快递来解释,有三个同事预 ...

  4. Knockout v3.4.0 中文版教程-16-控制流-foreach绑定

    2. 控制流 1. foreach绑定 目的 foreach绑定会遍历一个数组,为每个数组项生成重复的元素标记结构并做关联.这在渲染列表或表格的时候特别有用. 假设你的数组是一个监控数组,之后无论你进 ...

  5. Python开发:网络编程

    Python 提供了两个级别访问的网络服务.: 低级别的网络服务支持基本的 Socket,它提供了标准的 BSD Sockets API,可以访问底层操作系统Socket接口的全部方法. 高级别的网络 ...

  6. c++ string char* 获取输入值的区别

    #include <iostream> #include <string> using namespace std; void reverseStr(string &s ...

  7. mysql条件查询and or使用实例及优先级介绍

    mysql and与or介绍 AND 和 OR 可在 WHERE 子语句中把两个或多个条件结合起来. 使用OR关键字时: 只要符合这几个查询条件的其中一个条件,这样的记录就会被查询出来. 如果不符合这 ...

  8. CSU-1336: Interesting Calculator,最短路思想!

    1336: Interesting Calculator 这道题被LZQ抢了一血,于是去读题发现题意不难,纯广搜结果写的一塌糊涂. 题意:给你两个数x,y.由x每次可以经过一系列操作变换,每个变换都有 ...

  9. 九度oj 题目1107:搬水果

    题目描述: 在一个果园里,小明已经将所有的水果打了下来,并按水果的不同种类分成了若干堆,小明决定把所有的水果合成一堆.每一次合并,小明可以把两堆水果合并到一起,消耗的体力等于两堆水果的重量之和.当然经 ...

  10. MapReduce和Hadoop流

    MapReduce:分布式计算的框架 MapReduce是一个软件框架,可以将单个计算作业分配给多台计算机执行. MapReduce在大量节点组成的集群上运行.它的工作流程是:单个作业被分成很多小份, ...