android控件
移动爱好者
这个作者很懒,什么都没留下…
展开
-
如果写一个微博的一个ListView
先上效果图:这是个ListView:layout是:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:原创 2014-08-01 23:05:31 · 1194 阅读 · 0 评论 -
android的ViewPager和Animation的一些使用(二)
Animation的部分android的animation分为scale,rotate,tranlateAnimation,alpha这几种start animation的方式以下几种: t1_icon1.setImageResource(R.drawable.t1_frame_animation); //t1_frame_animation这个动画是放在drawab原创 2014-07-15 11:20:20 · 1593 阅读 · 2 评论 -
AlertDialog自定义View的用法+如何改变弹出框的大小
android系统定义了弹出框,支持我们自定义布局: public AlertDialog getEditCustomDialog() { LayoutInflater inflater = getLayoutInflater(); View view = inflater.inflate(R.layout.custom_message_rename, null); AlertDi原创 2014-07-11 11:59:42 · 8896 阅读 · 0 评论 -
android如何写一个投票或是表达观点的界面
先上图:把这些表示观点的view放在一个LinearLayout里:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/repost_vote_tag_list" android:l原创 2014-08-04 07:07:38 · 3260 阅读 · 0 评论 -
android Title滑块动画实现(适合新闻客户端多种栏目的展示)
先上效果图,选择不同的模块,滑动会通过动画形式滑过去,这种适合新闻客户端多种栏目的展示:这么写Layout:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="原创 2014-07-01 13:20:43 · 2976 阅读 · 15 评论 -
android的ViewPager和Animation的一些使用(一)
android的ViewPager是一个可以支持手势来切换View的控件,很适合来做用户引导的页面:如果有4张图,那么我们这样来写Layout:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/whats_new_main_view" andr原创 2014-07-15 10:54:21 · 1941 阅读 · 0 评论 -
如果给Contact的List加一个用字母排序的导航
效果图:这样写Layout:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:rcm="http://schemas.android.com/apk/res/com.ringcentral.android" android:id="@+id/cont原创 2014-08-24 15:29:15 · 1712 阅读 · 0 评论 -
android一个弹出菜单的动画(一)
先上效果图:先写Layout文件:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_paren原创 2014-08-06 17:53:18 · 2765 阅读 · 1 评论 -
如何写一个可以展开的TextView
原理是通过点击的时候设置 setMaxLines(lineNum)来实现:public class ExpandableTextView extends TextView { private static int MIN_LINE_NUM = 2; private static int MAX_LINE_NUM = 20; private int lineNum = M原创 2014-08-25 07:25:26 · 2069 阅读 · 1 评论 -
如果写一个点击view带动画的下滑展开显示隐藏内容的控件
原理是在onMeasure中得到隐藏内容的高度,点击这个view的时候对隐藏的view startAnimation,让它的高度从0增长到onMeasure得到的这个View的measureHeight具体这样写:public class ExpandableLayout extends LinearLayout { private Context mContext; pri原创 2014-08-25 06:45:10 · 5999 阅读 · 2 评论 -
EditText键盘点击Next跳转,AutoCompleteTextView控件和Chronometer控件
先上图:原创 2014-08-01 21:02:52 · 1198 阅读 · 0 评论 -
一个带动画的页面底部的TabBar的实现
有时有这样一个需求,页面底部有几个图标可以点击,如果一个screenWidth显示不下这些图标,则这一列图标最后一个是more,点击more,可以通过动画展示两列图标这样来加入layout中:<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="ma原创 2014-08-13 22:01:29 · 1884 阅读 · 1 评论 -
android的ListView点击item使item展开的做法
直接上代码把,主要是重新给item measure高度,直接上代码把import java.util.ArrayList;import android.app.Activity;import android.os.Bundle;import android.view.LayoutInflater;import android.view.MotionEvent;import andr原创 2014-08-16 10:07:05 · 8380 阅读 · 11 评论 -
介绍ListView中的几种位置关系和LayoutAnimation在listview中的应用
ListView的属性:1.ListView的XML属性android:divider//在列表条目之间显示的drawable或colorandroid:dividerHeight//用来指定divider的高度android:entries//构成ListView的数组资源的引用。对于某些固定的资源,这个属性提供了比在程序中添加资源更加简便的方式android:footerDi原创 2014-08-15 16:33:28 · 1356 阅读 · 0 评论 -
android一个上传图片的例子,包括如何终止上传过程,如果在上传的时候更新进度条(二)
可以这样来实现上传:activity中执行: private class UploadPhotoTask extends AsyncTask{ @Override protected void onPreExecute() { super.onPreExecute(); } protected Boolean doInBackground(String.原创 2014-08-10 09:19:26 · 2370 阅读 · 0 评论 -
android如果重写onDraw实现一个类似TextView可以显示表情和链接的控件(一)
先看效果图:写一个超连接支持的对象:/**作为超连接显示的对象*/public class LinkInfo implements Comparable{ private String content; private String type; private String id; private boolean bIsFace = false;原创 2014-08-10 15:21:19 · 1717 阅读 · 0 评论 -
android TabHost的一种用RadioButton来实现的切换
Layout:<TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLa原创 2014-08-01 22:08:24 · 1121 阅读 · 0 评论 -
android的notification的写法
这样来写: public void onCreate() { super.onCreate(); ntfmngr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); setNotifyType(R.drawable.logo,"aaaaaaaaaaa",3); } private void setN原创 2014-08-02 06:25:52 · 1131 阅读 · 0 评论 -
android如果用ListView做一个表格形式
效果图:这样来写:@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test); ListView list = (ListView)findViewById(R.i原创 2014-08-01 20:33:56 · 3526 阅读 · 1 评论 -
如果写一个列表点击一张图片来preview这张图片
可以才用继承AlertDialog的形式来写:点击张图:public void onClick(View v) { viewBigsizeBmp(((ImageView) v).getDrawable(), Constants.PREVIEW_BMP_DIR_SUFFIX); } private void viewBigsizeBmp(Drawable drawable,原创 2014-08-01 22:47:25 · 1185 阅读 · 0 评论 -
如果写一个android桌面滑动切换屏幕的控件(一)
首先这个控件应该是继承ViewGroup:初始化:public class MyGroup extends ViewGroup{ private Scroller mScroller; private float mOriMotionX; private float mLastMotionX; private VelocityTracker mVelocityTracker;原创 2014-08-08 17:45:42 · 1758 阅读 · 0 评论 -
如果写一个android桌面滑动切换屏幕的控件(三)
下面我们把这个控件内嵌到Layout中做一些动画和展示,效果图:这个子控件可以上下移动,可以左右滑动,如果上下滑动距离大于左右滑动距离,则必须上下滑动这样来写onTouch事件: @Override public boolean onTouchEvent(MotionEvent ev) { if (mVelocityTracker == null) { m原创 2014-08-08 20:04:32 · 1554 阅读 · 1 评论 -
如果写一个android桌面滑动切换屏幕的控件(二)
在viewgroup执行:public void snapToScreen(int whichScreen) { whichScreen = Math.max(0, Math.min(whichScreen, getChildCount() - 1)); boolean changingScreens = whichScreen != mCurrentScreen; mNext原创 2014-08-08 19:15:00 · 1440 阅读 · 0 评论 -
android一个弹出菜单的动画(二)
如果做一个弹出的控件,我们可以进行添加view:写class SatelliteMenu extends FrameLayoutprivate void init(Context context, AttributeSet attrs, int defStyle) { inflate(context, R.layout.sat_main, this); imgMain = (Ima原创 2014-08-08 16:34:43 · 1716 阅读 · 0 评论 -
如果做一个精美的Login界面(解决了一EditText自带clear的功能,类似iphone的UITextField)
先上图: XML为:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:la原创 2014-07-10 13:55:50 · 2594 阅读 · 0 评论 -
自定义TextView解决超长文字显示的问题
很多时候由于手机屏幕的显示,TextView原创 2014-06-19 13:12:53 · 3694 阅读 · 1 评论 -
android如何在textview或edittext上添加表情
先上效果图:首先来写一个表情的GridViewpublic class EmotionView extends LinearLayout implements OnItemClickListener { private GridView mGridView; private static final ArrayList emotionDisplayList = new原创 2014-07-31 06:53:21 · 4253 阅读 · 1 评论 -
android如果重写onDraw实现一个类似TextView可以显示表情和链接的控件(二)
下面来写IntroView的onMeasureHeight:private int measureHeight(int measureSpec) { int result = 0; int specMode = MeasureSpec.getMode(measureSpec); int specSize = MeasureSpec.getSize原创 2014-08-10 15:32:13 · 1632 阅读 · 0 评论 -
android如何写一个循环文字滚动的TextView
我们来看这样一个Text("如何在TextView中插入表情符号如(#f1),邮件youjiancau@sina.com,电话号码18559298168呢,默认的TextView是支持不了这个特性的"),我们如何把里面的表情标签,电话号码等提取出来的,这个我可以用正则表达式可以实现:private static Pattern EMAIL_PATTERN = Patterns.EMAIL_A...原创 2014-08-10 16:34:21 · 5922 阅读 · 0 评论 -
Dialog在android中的应用(二)
如果实现一个带动画的下拉的Dialog沿用上篇的基类,实现实际上的子类:public class DropDownFilterDialogForPhone extends DropDownFilterDialog { private boolean mShowAnimation = true; private boolean mIsInAnimation;原创 2015-05-11 14:02:01 · 731 阅读 · 0 评论