- 浏览: 166971 次
- 性别:
- 来自: 北京
最新评论
-
wangzhengfu:
看你这文章很纠结,既然把图贴出来了,为啥不贴上代码呢
android EditText 去除边框 -
sovio:
...
android EditText 去除边框 -
kdac:
啥J8翻译啊,谷歌翻译贴出来的吧?翻译不了就放原文,不伦不类, ...
android 弹出软键盘将底部视图顶起问题 -
shiny_txdd:
17:34:47,806 ERROR [ContextLoad ...
tomcat项目转jboss5.0 -
lenomon:
这里有篇实现无下划线的,Android使用TextView实现 ...
Android TextView中文字设置超链接、颜色、字体
模仿renren的左右划动菜单栏,主要通过HorizontalScrollView来实现横向划动布局。通过判HorizontalScrollView对象的scrollX来控制左右两边的图片显隐。显示效果如图:
具体Java代码如下:
/** * * @author Shaodong Wu * 模仿renren的左右划动菜单栏 */ public class JustTestActivity extends Activity { private static final String TAG="JustTestActivity"; /** Called when the activity is first created. */ HorizontalScrollView scrollBar; RadioGroup radioGroup; int widthX; ImageView arrowl; ImageView arrowr; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); scrollBar=(HorizontalScrollView)this.findViewById(R.id.scroll_bar); radioGroup=(RadioGroup)this.findViewById(R.id.radioGroup); arrowl=(ImageView)this.findViewById(R.id.arrowl); arrowr=(ImageView)this.findViewById(R.id.arrowr); scrollBar.fling(1000); //通过判断目标的scrollX来控制左右两边的图片显隐 scrollBar.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent event) { Log.i(TAG, "scrollX ---->"+scrollBar.getScrollX()); Log.i(TAG, "windth ---->"+scrollBar.getWidth()); LinearLayout linear=(LinearLayout)scrollBar.getChildAt(0); int radioWidth= linear.getChildAt(0).getWidth(); Log.i(TAG, "radio width--->"+radioWidth); if(scrollBar.getScrollX()<6){ arrowl.setVisibility(View.GONE); }else if(scrollBar.getScrollX()+scrollBar.getWidth()>radioWidth-6){ arrowr.setVisibility(View.GONE); }else{ arrowr.setVisibility(View.VISIBLE); arrowl.setVisibility(View.VISIBLE); } return false; } }); } @Override protected void onStart() { // TODO Auto-generated method stub super.onStart(); } }
Xml布局代码如下:
<?xml version="1.0" encoding="utf-8"?> <FrameLayout android:id="@+id/frameLayout1" android:scrollbars="none" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent"> <HorizontalScrollView android:layout_width="fill_parent" android:scrollbars="none" android:fillViewport="true" android:layout_height="wrap_content" android:fadingEdge="none" android:id="@+id/scroll_bar"> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" > <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/radioGroup" android:orientation="horizontal" android:gravity="center_vertical"> <RadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏1" style="@style/main_tab_bottom"/> <RadioButton android:id="@+id/radio2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏2" style="@style/main_tab_bottom"/> <RadioButton android:id="@+id/radio3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏3" style="@style/main_tab_bottom"/> <RadioButton android:id="@+id/radio4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏4" style="@style/main_tab_bottom"/> <RadioButton android:id="@+id/radio5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏5" style="@style/main_tab_bottom"/> <RadioButton android:id="@+id/radio6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏6" style="@style/main_tab_bottom"/> <RadioButton android:id="@+id/radio7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏7" style="@style/main_tab_bottom"/> <RadioButton android:id="@+id/radio7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏8" style="@style/main_tab_bottom"/> <RadioButton android:id="@+id/radio9" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="游戏9" style="@style/main_tab_bottom"/> </RadioGroup> </LinearLayout> </HorizontalScrollView> <ImageView android:id="@+id/arrowl" android:layout_height="wrap_content" android:visibility="gone" android:layout_width="wrap_content" android:src="@drawable/arrowl" android:layout_gravity="left|center_vertical"></ImageView> <ImageView android:layout_height="wrap_content" android:layout_gravity="right|center_vertical" android:visibility="gone" android:layout_width="wrap_content" android:src="@drawable/arrowr" android:id="@+id/arrowr"/> </FrameLayout>
完整项目见附件。
发表评论
-
Android中canvas和paint的关系及使用
2011-11-30 10:15 2215刚刚开始接触学习Android的同鞋们在看到工程中出现的那么 ... -
android 抓包
2011-07-12 10:28 39471、下载TcpDump for Android ,或者本地下 ... -
Android参数设置父布局集体宽高
2011-06-21 11:47 3390LinearLayout gridContainer = (L ... -
Android应用按返回键完全退出应用
2011-06-07 17:58 7193很多网友可能发现自己 ... -
GIT和repo使用方法,下载android-2.6.29内核
2011-06-07 14:45 1958http://hi.baidu.com/kkernel/ ... -
动态增加TableLayout的行
2011-06-02 15:43 2519Just like HTML Tables on webpag ... -
如何申请 android google map API key
2011-06-01 15:16 15911.首先要得到你的debug keystore位置: 打 ... -
Android TextView中文字设置超链接、颜色、字体
2011-05-27 12:27 5334TextView是用来显示文本的,有时需要给TextView中 ... -
设置ProgressBar的颜色
2011-05-26 10:05 2199在《Android/OPhone开发完全讲义》 ... -
Android 调用系统的照相,浏览图片,转存并裁剪!
2011-05-25 12:59 4569public class AddCardActivity ex ... -
修改TabHost默认样式
2011-05-10 13:52 3169TabHost是Android提供的一个容器组件, ... -
Android控件美化Shape
2011-05-04 09:59 1175当然除了使用drawable这样的图片外今天谈下自定义图形 ... -
android开发中WebView的使用(附完整程序)
2011-05-03 14:00 2082WebView是个好东西,作用相当于一个迷你的浏览器,采用We ... -
android 弹出软键盘将底部视图顶起问题
2011-04-19 13:20 6881今天要做一个搜索功能,搜索界面采用AutoCompleteTe ... -
自定义ListView行间的分割线
2011-04-18 10:18 1582在Android平台中系统控件提供了灵活的自定义选项,所有 ... -
android xml中应用占位符
2011-04-02 18:24 1546Formatting and Styling Here ar ... -
android Toast大全(五种情形)建立属于你自己的Toast
2011-04-02 18:18 912Toast用于向用户显示一些帮助/提示。下面我做了5中效果,来 ... -
JadEclipse工具的使用
2011-04-01 11:49 2536JadEclipse工具的使用 1、下载工具 JadEcl ... -
Android 反编译apk 到java源码的方法
2011-04-01 11:20 942Android由于其代码是放在dalvik虚拟机上的托管代码, ... -
Android dex ,xml 文件反编译方法【转】
2011-04-01 11:19 1494Dex 文件是Android上运行于delvik的java二进 ...
相关推荐
android 人人 renren 源码 使用的时候,必须确保机子的时间是正确的(不能出现2009年的情况)否则会报错
Renren-api-android 学习Renren开发的可能用得到
android RenRen源码.rar
安卓Android源码——RenRen.zip
Renren-api-android-sdk-2.0 最新的人人 android sdk 文档
Android应用源码之renren.zip项目安卓应用源码下载Android应用源码之renren.zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
源码参考,欢迎下载
renren-security (人人权限系统)是一套轻量级的权限系统,主要包括用户管理、角色管理、部门管理、菜单管 理、定时任务、参数管理、字典管理、文件上传、系统日志、文章管理、APP模块等功能。其 中,还拥有多数据源...
renren-fast-vue前端魔改
renren-fast是一个轻量级的,前后端分离的Java快速开发平台,能快速开发项目并交付【接私活利器】 支持MySQL、Oracle、SQL Server、PostgreSQL等主流数据库 - 前端地址:...
使用Spring Boot、Shiro、MyBatis、Redis、Bootstrap、Vue2.x等框架,包含:管理员列表、角色管理、菜单管理、定时任务、参数管理、代码生成器、日志管理、云存储、API模块(APP接口开发利器)、前后端分离等。
检测网络运行状态,生成网络健康报告统计TOP10应用、TOP10流量生成直观的图形报告提供ping、tracert route诊断工具 。
renren-fast开发文档3.0_完整版.pdf
Android应用源码开发Demo,主要用于毕业设计学习。
renren api help you to access the source in renren web
最近在学习renren-fast-vue,npm install时疯狂报错 最开始时报错是说node-sass下载失败,没办法只能谷歌一下求救前人,然后有说法是 下载被墙,使用淘宝镜像资源 npm install -g cnpm --registry=...
renren-fast开发文档3.0最新版.pdf,renren-fast是一个轻量级的,前后端分离的Java快速开发平台,能快速开发项目并交付【接私活利器】
人人权限系统是一套轻量级的权限系统,主要包括用户管理、角色管理、部门管理、菜单管 理、定时任务、参数管理、字典管理、文件上传、系统日志、APP模块等功能。其中,还拥有 多数据源、数据权限、Redis缓存动态开启...
renren-fast-vue基于vue、element-ui构建开发,实现renren-fast后台管理前端功能,提供一套更优的前端解决方案。 演示地址:fast.demo.renren.io(账号密码:admin / admin)