效果是这样的:点击按下弹出表格的按钮,会由下往上弹出右边的列表,按下返回按钮就由上往下退出界面。

布局文件:

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" > <Button
android:id="@+id/btnPopup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/bg"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:textColor="@color/white"
android:text="按下弹出表格" /> <LinearLayout
android:id="@+id/ll_popupLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone" > <include layout="@layout/business_list" />
</LinearLayout> </RelativeLayout>

/Demo1/res/layout/business_list_item.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal" > <TextView
android:id="@+id/tv_business"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_weight="1"
android:gravity="center"
android:text="@string/tv_business"
android:textColor="#ff000000"
android:textSize="15sp" /> <TextView
android:id="@+id/tv_business_pay"
android:layout_width="90dp"
android:layout_height="40dp"
android:layout_marginLeft="9dp"
android:layout_marginRight="9dp"
android:gravity="center"
android:text="@string/tv_business_pay"
android:textColor="#ff000000"
android:textSize="15sp" /> </LinearLayout>

/Demo1/res/layout/business_list.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_popupLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:text="已开通查分业务列表"
android:textColor="#ff000000"
android:textSize="15sp" /> <FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" > <LinearLayout
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/banner_bg"
android:orientation="horizontal" > <TextView
android:id="@+id/tv_business"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_weight="1"
android:gravity="center"
android:text="@string/tv_business"
android:textColor="#ff000000"
android:textSize="15sp" /> <TextView
android:id="@+id/tv_business_pay"
android:layout_width="90dp"
android:layout_height="40dp"
android:layout_marginLeft="9dp"
android:layout_marginRight="9dp"
android:gravity="center"
android:text="@string/tv_business_pay"
android:textColor="#ff000000"
android:textSize="15sp" />
</LinearLayout> <ListView
android:id="@+id/lv_business"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginTop="40dp"
android:background="@drawable/score_list_bg"
android:cacheColorHint="@color/transparent"
android:divider="@drawable/horizontal_line"
android:listSelector="@color/transparent" /> <ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="2dp"
android:layout_marginLeft="50dp"
android:layout_marginTop="2dp"
android:background="@drawable/vertical_line" />
</FrameLayout> <Button
android:id="@+id/btnBack"
android:layout_width="80dp"
android:layout_height="48dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@drawable/back_btn_bg"
android:text="返回"
android:textColor="#ffffff" /> </LinearLayout>

动画文件:

/Demo1/res/anim/score_business_query_enter.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <translate
android:fromYDelta="100%p"
android:duration="600"
/>
</set>

/Demo1/res/anim/score_business_query_exit.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <translate
android:toYDelta="100%p"
android:duration="600"
/>
</set>

Acitivity

package com.wwj.demo1;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleAdapter; public class MainActivity extends Activity { Button btnPopup;
Button btnBack;
ListView listView;
LinearLayout ll_Popup; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); btnPopup = (Button) findViewById(R.id.btnPopup); ll_Popup = (LinearLayout) findViewById(R.id.ll_popupLayout);
// 加载动画
final Animation animation1 = AnimationUtils.loadAnimation(this,
R.anim.score_business_query_enter);
final Animation animation2 = AnimationUtils.loadAnimation(this,
R.anim.score_business_query_exit);
btnPopup.setOnClickListener(new OnClickListener() { @Override
public void onClick(View arg0) {
ll_Popup.setVisibility(View.VISIBLE); // 显示布局
ll_Popup.startAnimation(animation1); // 开始动画 }
}); btnBack = (Button) findViewById(R.id.btnBack);
btnBack.setOnClickListener(new OnClickListener() { @Override
public void onClick(View v) {
// TODO Auto-generated method stub
ll_Popup.setVisibility(View.GONE); // 取出布局
ll_Popup.startAnimation(animation2); // 开始退出动画
}
}); setListAdapter(); } /**
* 填充列表
*/
private void setListAdapter() { List<Map<String, String>> data = new ArrayList<Map<String, String>>(); // 测试数据
for (int i = 0; i < 10; i++) {
Map<String, String> map = new HashMap<String, String>();
map.put("tv_business", "武汉中考查询测试");
map.put("tv_business_pay", "0元/次");
data.add(map);
} listView = (ListView) findViewById(R.id.lv_business);
SimpleAdapter adapter = new SimpleAdapter(this, data,
R.layout.business_list_item, new String[] { "tv_business",
"tv_business_pay" }, new int[] { R.id.tv_business,
R.id.tv_business_pay });
listView.setAdapter(adapter);
}
}

文章转载于:http://blog.csdn.net/wwj_748/article/details/9854655

Android listview 制作表格样式+由下往上动画弹出效果实现的更多相关文章

  1. 自定义Dialog,实现由下而上的弹出效果(模仿QQ退出等)

    方法: public Dialog createDialog(Context context, View view) { Dialog mSelectPhotoDialog = null; mSele ...

  2. Android 仿 新闻阅读器 菜单弹出效果(附源码DEMO)

    这一系列博文都是:(android高仿系列)今日头条 --新闻阅读器 (一) 开发中碰到问题之后实现的,觉得可能有的开发者用的到或则希望独立成一个小功能DEMO,所以就放出来这么一个DEMO. 原本觉 ...

  3. Android PopupWindow 仿微信弹出效果

    项目中,我须要PopupWindow的时候特别多,这个东西也特别的好使,所以我今天给大家写一款PopupWindow 仿微信弹出效果.这样大家直接拿到项目里就能够用了! 首先让我们先看效果: 那么我首 ...

  4. Web标准:八、下拉及多级弹出菜单

    Web标准:八.下拉及多级弹出菜单 知识点: 1.带下拉子菜单的导航菜单 2.绝对定位和浮动的区别和运用 3.CSS自适应宽度滑动门菜单   1)带下拉子菜单的导航菜单 带下拉子菜单的就是在一级导航下 ...

  5. firefox浏览器中 bootstrap 静态弹出框中select下拉框不能弹出(解决方案)

    问题出现场景1: 在firefox浏览器中在bootstrap弹出的modal静态框中再次弹出一个静态框时 select下拉框不能弹出选项 解决方案:去掉最外层静态框的 tabindex=" ...

  6. ideal取消按下两次shift弹出搜索框 修改idea,webstrom,phpstrom 快捷键double shift 弹出search everywhere

    因为经常需要在中英文之间切换,所以时常使用shift键,一不小心就把这个Searchwhere 对话框调出来了,很是麻烦. 因此痛定思痛, 我决定将这个按两下shift键就弹出搜索框的快捷键禁用了! ...

  7. 黄聪:TinyMCE 4 增强 添加样式、按钮、字体、下拉菜单和弹出式窗口

    我最喜欢 WordPress 3.9 的更新是使用了 TinyMCE 4.0 编辑器.新的 TinyMCE 看起来看起来更整洁(真正匹配WP仪表板),它有一些非常不错的附加功能.我的很多老主题和插件必 ...

  8. 【android开发】使用PopupWindow实现页面点击顶部弹出下拉菜单

    没有太多花样,也没有很复杂的技术,就是简单的PopupWindow的使用,可以实现点击弹出一个自定义的view,view里可以随便设计,常用的可以放一个listview. demo中我只是一个点击展示 ...

  9. Android开发实战之底部Dialog弹出效果

    在Android开发中,有很多情况下我们需要使用到对话框,遗憾的是,安卓自带的对话框样式不能满足我们实际的需要,所以往往需要我们自定义对话框,具体做法:写一个对话框继承自Dialog实现他的一个构造方 ...

随机推荐

  1. WebKit渲染基础(转载 学习中。。。)

    概述 WebKit是一个渲染引擎,而不是一个浏览器,它专注于网页内容展示,其中渲染是其中核心的部分之一.本章着重于对渲染部分的基础进行一定程度的了解和认识,主要理解基于DOM树来介绍Render树和R ...

  2. jQuery.form.js jQuery ajax异步提交form

    jQuery.form.js是一个form插件,支持ajax表单提交和ajax文件上传. 官网下载地址:http://plugins.jquery.com/form/ API ajaxForm 增加所 ...

  3. 深入理解PHP原理之变量作用域

    26 Aug 08 深入理解PHP原理之变量作用域(Scope in PHP)   作者: Laruence(   ) 本文地址: http://www.laruence.com/2008/08/26 ...

  4. phalcon: acl权限控制

    目录控制: public/index.php: $di['aclResource']=function(){ return include_once '../app/config/frontbackA ...

  5. DIY_hlstudio_WIN7PE【69M】网络版【89M】

    DIY_hlstudio_WIN7PE[69M]网络版[89M] hlstudio的骨头版PE非常精简,由于启动方式和用法不同,个人进行了如下修改:1.原来的合盘修改为bootmgr直接起动ISO镜像 ...

  6. js生成验证码

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. 带不带protype的区别

    总结写在前面: ①:带有protype:表示类的扩展,必须new后才能使用. ②:不带protype:属于静态方法,直接调用即可. html代码: <!DOCTYPE html> < ...

  8. 《Java程序设计》实验五 实验报告

    实验五 java网络编程 实验内容 XP基础 XP核心实践 相关工具 实验要求 1.没有Linux基础的同学建议先学习<Linux基础入门(新版)><Vim编辑器> 课程 2. ...

  9. 项目文件包含 ToolsVersion="12.0" 设置,但此工具集未知或缺失。

    项目属性(Alt+F7),再点常规,常规中有个平台工作集,把V120改成V110或者v100,然后就能正常运行了.

  10. BZOJ1932 [Shoi2007]Setstack 集合堆栈机

    妈呀...clj大爷太强啦! 原来还有set_union和set_intersection这种东西... 于是只要把栈顶的每个元素hash一下记录到一个vector里去就好了 /*********** ...