- 浏览: 325152 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
xuanyuanxiaoxue:
...
Android - LayoutInflater -
柴兴博:
不错 多谢
Android 悬浮Activity并可拖动(访悬浮歌词) -
di1984HIT:
写的很好,我收藏一下。
java之动态代理模式(JDK和cglib) -
chinacssnj:
待测试,明天测,测试的结果发给大家
网络开发上传文件到服务器 -
fx_199182:
...
Android之MediaPlayer
一、曾经做过一个项目,用的大概就是这种布局,title布局,title右边是ImageView,点击每一个图标,弹出PopupWin,点击其他按钮PopupWin就在原地消失。这个效果还很不错的,我挺喜欢的,所以抽空把它写了出来。现在将代码给大家提供一下,希望能给大家一些提示。先看截图:
点击MP3这个图标
点击PopupWin苹果MP3这列弹出Toast:
说明:每一个popupwin里面我都写了点击事件,就是弹一个toast,目前我就截图截了四张,给大家演示一下!
二:布局文件
1、activity_title.xml布局文件代码:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/title_bg_button"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="78dip" android:background="@drawable/title_bg"> <RelativeLayout android:id="@+id/RelativeLayout_title" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center_horizontal|center_vertical" android:layout_weight="1.0"> <ImageButton android:id="@+id/title_about" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/main_top_image" /> </RelativeLayout> <LinearLayout android:id="@+id/LinearLayout_title02" android:gravity="right" android:layout_gravity="right|center" android:layout_marginRight="10sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_marginTop="10dip"> <LinearLayout android:id="@+id/title_mp3" android:paddingRight="5px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center" > <ImageView android:id="@+id/gridlist_image" android:background="@drawable/title1" android:layout_width="32dip" android:scaleType="centerInside" android:layout_height="32dip"></ImageView> <TextView android:id="@+id/grid_list_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:text="MP3" android:textSize="13dp" /> </LinearLayout> <LinearLayout android:id="@+id/title_phone_sms" android:paddingLeft="5px" android:paddingRight="5px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center" > <ImageView android:id="@+id/title_new_doc" android:layout_width="32dip" android:layout_height="32dip" android:scaleType="centerInside" android:background="@drawable/title2"> </ImageView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:text="短信" android:textSize="13dp" /> </LinearLayout> <LinearLayout android:paddingLeft="5px" android:paddingRight="5px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center" android:id="@+id/title_addnew"> <ImageView android:id="@+id/imageView1" android:background="@drawable/title3" android:layout_width="32dip" android:layout_height="32dip" android:scaleType="centerInside"/> <TextView android:textColor="#ffffffff" android:id="@+id/textView1" android:textSize="13dp" android:text="新建" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView> </LinearLayout> <LinearLayout android:id="@+id/title_music" android:paddingLeft="5px" android:paddingRight="5px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center" > <ImageView android:layout_width="32dip" android:layout_height="32dip" android:background="@drawable/title4" android:scaleType="centerInside"></ImageView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:text="音乐" android:textSize="13dp" /> </LinearLayout> <LinearLayout android:id="@+id/title_phone" android:paddingLeft="5px" android:paddingRight="5px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center" > <ImageView android:layout_width="32dip" android:layout_height="32dip" android:background="@drawable/title5" android:scaleType="centerInside"></ImageView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:text="电话" android:textSize="13dp" /> </LinearLayout> <LinearLayout android:id="@+id/title_author" android:paddingLeft="5px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center" > <ImageView android:id="@+id/title_back_image" android:background="@drawable/title6" android:layout_width="32dip" android:layout_height="32dip" android:scaleType="centerInside"> </ImageView> <TextView android:id="@+id/title_back_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:text="作者" android:textSize="13dp" /> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout>
2、new_file.xml
<?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="280px" android:layout_height="wrap_content"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="19dp"></LinearLayout> <LinearLayout android:id="@+id/new_file_text" android:layout_width="280px" android:layout_height="wrap_content" android:background="@drawable/dialog_title1"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:gravity="center_horizontal" android:text="大明原创" /> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="19dp" android:id="@+id/new_file_layout" android:paddingLeft="8dip" android:layout_marginTop="-48dp"> </LinearLayout> <LinearLayout android:id="@+id/LinearLayout_Viewer1" android:layout_marginTop="28dp" android:layout_width="280px" android:layout_height="wrap_content" android:orientation="vertical" android:paddingLeft="10px" android:paddingRight="10px" android:background="@drawable/dialog_body1" android:layout_weight="1.0"> <LinearLayout android:layout_width="fill_parent" android:layout_height="30dip" android:background="@drawable/word_view" android:paddingLeft="10dip" android:id="@+id/row1"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|center_horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:layout_marginLeft="60dip" style="@style/TextFormat" android:id="@+id/text1" /> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="2dip" android:background="#ff888888" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="30dip" android:background="@drawable/word_view" android:paddingLeft="10dip" android:id="@+id/row2"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|center_horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:layout_marginLeft="60dip" style="@style/TextFormat" android:id="@+id/text2" /> </RelativeLayout> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="280px" android:layout_height="wrap_content" android:background="@drawable/dialog_bottom1" /> </LinearLayout>
三、MainActivity类,java类实现以上功能:
package com.cn.android; import android.app.Activity; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { /** Called when the activity is first created. */ DisplayMetrics metrics; int mpaddingLeft = 5; int mviewpos[] = new int[2]; int popWidth = 280; private View MenuView = null; PopupWindow pop; LinearLayout new_name; LinearLayout new_num; public static final int NEW_NAME1= 1; public static final int NEW_NUM1 = 2; public static final int NEW_NAME2= 3; public static final int NEW_NUM2 = 4; public static final int NEW_NAME3= 5; public static final int NEW_NUM3 = 6; public static final int NEW_NAME4= 7; public static final int NEW_NUM4 = 8; public static final int NEW_NAME5= 9; public static final int NEW_NUM5 = 10; public static final int NEW_NAME6= 11; public static final int NEW_NUM6 = 12; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); setContentView(R.layout.activity_title); //初始化ImageView initTitlebarBtn(); } private void initTitlebarBtn() { ImageButton title_about = (ImageButton) findViewById(R.id.title_about); title_about.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub //添加自己需要的代码 } }); LinearLayout titlephone1 = (LinearLayout) findViewById(R.id.title_mp3); titlephone1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mpaddingLeft = 5; v.getLocationOnScreen(mviewpos); if (!(mviewpos[0] + popWidth < metrics.widthPixels)) { mpaddingLeft = mviewpos[0] - (metrics.widthPixels - popWidth); } MenuView = getLayoutInflater().inflate(R.layout.new_file, null); TextView text_row1 = (TextView)MenuView.findViewById(R.id.text1); TextView text_row2 = (TextView)MenuView.findViewById(R.id.text2); text_row1.setText("苹果MP3"); text_row2.setText("魅族MP3"); initLayout(MenuView, R.id.title_mp3); popMenu(MenuView, v); } }); LinearLayout titlephonesms = (LinearLayout) findViewById(R.id.title_phone_sms); titlephonesms.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.getLocationOnScreen(mviewpos); if (!(mviewpos[0] + popWidth < metrics.widthPixels)) { mpaddingLeft = mviewpos[0] - (metrics.widthPixels - popWidth); } MenuView = getLayoutInflater().inflate(R.layout.new_file, null); TextView text_row1 = (TextView)MenuView.findViewById(R.id.text1); TextView text_row2 = (TextView)MenuView.findViewById(R.id.text2); text_row1.setText("搞笑短信"); text_row2.setText("经典短信"); initLayout(MenuView, R.id.title_phone_sms); popMenu(MenuView, v); } }); LinearLayout titleaddnew = (LinearLayout) findViewById(R.id.title_addnew); titleaddnew.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.getLocationOnScreen(mviewpos); if (!(mviewpos[0] + popWidth < metrics.widthPixels)) { mpaddingLeft = mviewpos[0] - (metrics.widthPixels - popWidth); } MenuView = getLayoutInflater().inflate(R.layout.new_file, null); TextView text_row1 = (TextView)MenuView.findViewById(R.id.text1); TextView text_row2 = (TextView)MenuView.findViewById(R.id.text2); text_row1.setText("新建联系人"); text_row2.setText("新建记事本"); initLayout(MenuView, R.id.title_addnew); popMenu(MenuView, v); } }); LinearLayout titlemusic = (LinearLayout) findViewById(R.id.title_music); titlemusic.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.getLocationOnScreen(mviewpos); if (!(mviewpos[0] + popWidth < metrics.widthPixels)) { mpaddingLeft = mviewpos[0] - (metrics.widthPixels - popWidth); } MenuView = getLayoutInflater().inflate(R.layout.new_file, null); TextView text_row1 = (TextView)MenuView.findViewById(R.id.text1); TextView text_row2 = (TextView)MenuView.findViewById(R.id.text2); text_row1.setText("孙燕姿音乐"); text_row2.setText("周杰伦音乐"); initLayout(MenuView, R.id.title_music); popMenu(MenuView, v); } }); LinearLayout titlephone2 = (LinearLayout) findViewById(R.id.title_phone); titlephone2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.getLocationOnScreen(mviewpos); if (!(mviewpos[0] + popWidth < metrics.widthPixels)) { mpaddingLeft = mviewpos[0] - (metrics.widthPixels - popWidth); } MenuView = getLayoutInflater().inflate(R.layout.new_file, null); TextView text_row1 = (TextView)MenuView.findViewById(R.id.text1); TextView text_row2 = (TextView)MenuView.findViewById(R.id.text2); text_row1.setText("中国移动通讯"); text_row2.setText("中国联通通讯"); initLayout(MenuView, R.id.title_phone); popMenu(MenuView, v); } }); LinearLayout titleauthor = (LinearLayout) findViewById(R.id.title_author); titleauthor.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { v.getLocationOnScreen(mviewpos); if (!(mviewpos[0] + popWidth < metrics.widthPixels)) { mpaddingLeft = mviewpos[0] - (metrics.widthPixels - popWidth); } MenuView = getLayoutInflater().inflate(R.layout.new_file, null); TextView text_row1 = (TextView)MenuView.findViewById(R.id.text1); TextView text_row2 = (TextView)MenuView.findViewById(R.id.text2); text_row1.setText("信息院软件0703"); text_row2.setText("学号:070203074"); initLayout(MenuView, R.id.title_author); popMenu(MenuView, v); } }); } public void popMenu(View menuview, View view) { if (pop == null) { pop = new PopupWindow(menuview, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true); pop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); pop.setAnimationStyle(R.style.PopupAnimation); pop.setOutsideTouchable(true); pop.showAsDropDown(view, Gravity.CENTER_HORIZONTAL, 0); pop.update(); } else { if (pop.isShowing()) { pop.dismiss(); pop = null; } else { pop = null; pop = new PopupWindow(menuview, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true); pop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); pop.setAnimationStyle(R.style.PopupAnimation); pop.setOutsideTouchable(false); pop.showAsDropDown(view, Gravity.CENTER_HORIZONTAL, 0); pop.update(); } } } public void initLayout(final View view, int id) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(new LayoutParam (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); ImageView imageView = new ImageView(this); imageView.setImageResource(R.drawable.dialog_arrow2); LinearLayout aLayout; switch (id) { case R.id.title_mp3: aLayout = (LinearLayout) view.findViewById(R.id.new_file_layout); aLayout.addView(imageView, params); aLayout.setPadding(mpaddingLeft, 0, 2, 0); new_name = (LinearLayout) view.findViewById(R.id.row1); fileOnClick(NEW_NAME1, new_name); new_num = (LinearLayout) view.findViewById(R.id.row2); fileOnClick(NEW_NUM1, new_num); break; case R.id.title_phone_sms: aLayout = (LinearLayout) view.findViewById(R.id.new_file_layout); aLayout.addView(imageView, params); aLayout.setPadding(mpaddingLeft+8, 0, 0, 0); new_name = (LinearLayout) view.findViewById(R.id.row1); fileOnClick(NEW_NAME2, new_name); new_num = (LinearLayout) view.findViewById(R.id.row2); fileOnClick(NEW_NUM2, new_num); break; case R.id.title_addnew: aLayout = (LinearLayout) view.findViewById(R.id.new_file_layout); aLayout.addView(imageView, params); aLayout.setPadding(mpaddingLeft+8, 0, 0, 0); new_name = (LinearLayout) view.findViewById(R.id.row1); fileOnClick(NEW_NAME3, new_name); new_num = (LinearLayout) view.findViewById(R.id.row2); fileOnClick(NEW_NUM3, new_num); break; case R.id.title_music: aLayout = (LinearLayout) view.findViewById(R.id.new_file_layout); aLayout.addView(imageView, params); aLayout.setPadding(mpaddingLeft+8, 0, 0, 0); new_name = (LinearLayout) view.findViewById(R.id.row1); fileOnClick(NEW_NAME4, new_name); new_num = (LinearLayout) view.findViewById(R.id.row2); fileOnClick(NEW_NUM4, new_num); break; case R.id.title_phone: aLayout = (LinearLayout) view.findViewById(R.id.new_file_layout); aLayout.addView(imageView, params); aLayout.setPadding(mpaddingLeft+8, 0, 0, 0); new_name = (LinearLayout) view.findViewById(R.id.row1); fileOnClick(NEW_NAME5, new_name); new_num = (LinearLayout) view.findViewById(R.id.row2); fileOnClick(NEW_NUM5, new_num); break; case R.id.title_author: aLayout = (LinearLayout) view.findViewById(R.id.new_file_layout); aLayout.addView(imageView, params); aLayout.setPadding(mpaddingLeft+8, 0, 0, 0); new_name = (LinearLayout) view.findViewById(R.id.row1); fileOnClick(NEW_NAME6, new_name); new_num = (LinearLayout) view.findViewById(R.id.row2); fileOnClick(NEW_NUM6, new_num); break; } } public void fileOnClick(int index, final LinearLayout mLayout) { switch (index) { case NEW_NAME1: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_name1 = Toast.makeText(MainActivity.this,"This is 苹果 MP3!",Toast.LENGTH_LONG); toast_new_name1.show(); pop.dismiss(); } }); break; case NEW_NUM1: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_num1 = Toast.makeText(MainActivity.this,"This is 魅族MP3!",Toast.LENGTH_LONG); toast_new_num1.show(); pop.dismiss(); } }); break; case NEW_NAME2: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { / / TODO Auto-generated method stub Toast toast_new_name2 = Toast.makeText(MainActivity.this,"This is 搞笑短信!",Toast.LENGTH_LONG); toast_new_name2.show(); pop.dismiss(); } }); break; case NEW_NUM2: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_num2 = Toast.makeText(MainActivity.this,"This is 经典短信!",Toast.LENGTH_LONG); toast_new_num2.show(); pop.dismiss(); } }); break; case NEW_NAME3: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_name3 = Toast.makeText(MainActivity.this,"This is 新建联系人!",Toast.LENGTH_LONG); toast_new_name3.show(); pop.dismiss(); } }); break; case NEW_NUM3: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_num3 = Toast.makeText(MainActivity.this,"This is 新建记事本!",Toast.LENGTH_LONG); toast_new_num3.show(); pop.dismiss(); } }); break; case NEW_NAME4: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_name4 = Toast.makeText(MainActivity.this,"This is 孙燕姿音乐!",Toast.LENGTH_LONG); toast_new_name4.show(); pop.dismiss(); } }); break; case NEW_NUM4: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_num4 = Toast.makeText(MainActivity.this,"This is 周杰伦音乐!",Toast.LENGTH_LONG); toast_new_num4.show(); pop.dismiss(); } }); break; case NEW_NAME5: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_name5 = Toast.makeText(MainActivity.this,"This is 中国移动通讯!",Toast.LENGTH_LONG); toast_new_name5.show(); pop.dismiss(); } }); break; case NEW_NUM5: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_num5 = Toast.makeText(MainActivity.this,"This is 中国联通通讯!",Toast.LENGTH_LONG); toast_new_num5.show(); pop.dismiss(); } }); break; case NEW_NAME6: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_name6 = Toast.makeText(MainActivity.this,"This is 信息院软件0703!",Toast.LENGTH_LONG); toast_new_name6.show(); pop.dismiss(); } }); break; case NEW_NUM6: mLayout.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Toast toast_new_num6 = Toast.makeText(MainActivity.this,"This is 学号:070203074",Toast.LENGTH_LONG); toast_new_num6.show(); pop.dismiss(); } }); break; default: break; } } }
四、设置PopupWin,设置进入和退出的的动画:
在res目录下建anim文件夹,在里面加入布局文件:
1、popup_enter.xml:
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:duration="800" android:fromYDelta="-100%" android:toYDelta="0.0" /> <!--在原地弹出效果--><set android:fromXScale="0.0" android:toXScale="1.0" android:fromYScale="0.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:duration="1000" /> <alpha android:interpolator="@android:anim/decelerate_interpolator" android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="1000" /> --> </set>
2、ppup_exit.xml
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:fromXScale="1.0" android:toXScale="0.5" android:fromYScale="1.0" android:toYScale="0.5" android:pivotX="50%" android:pivotY="50%" android:duration="500"/> <alpha android:interpolator="@android:anim/decelerate_interpolator" android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="500"/> </set>
五、在Values加入一个style.xml样式的xml文件:
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="TextFormat"> <item name="android:textSize">15dip</item> <item name="android:textColor">#ff000000</item> </style> <style name="PopupAnimation" parent="android:Animation" mce_bogus="1"> <item name="android:windowEnterAnimation">@anim/popup_enter</item> <item name="android:windowExitAnimation">@anim/popup_exit</item> </style> </resources>
1、里面有个word_view.xml:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/button_middle_sel" /> <item android:state_selected ="true" android:drawable="@drawable/button_middle_sel" /> </selector>
转自:http://blog.csdn.net/wdaming1986/article/details/6636112#reply
评论
2 楼
warnerhit
2011-12-23
<LinearLayout android:layout_width="fill_parent"
android:layout_height="19dp"
android:id="@+id/new_file_layout"
android:paddingLeft="8dip"
android:layout_marginTop="-48dp">
</LinearLayout>
这个,没看java代码的时候看半天不知道干嘛的, android:layout_marginTop="-48dp"为什么要这样用啊
android:layout_height="19dp"
android:id="@+id/new_file_layout"
android:paddingLeft="8dip"
android:layout_marginTop="-48dp">
</LinearLayout>
这个,没看java代码的时候看半天不知道干嘛的, android:layout_marginTop="-48dp"为什么要这样用啊
1 楼
warnerhit
2011-12-23
帮我解决了一个问题,太感谢了。。果断收藏!
发表评论
-
Android 漂亮的 Dialog (弹出框)
2012-02-13 23:35 4195在新浪微博Android客户端的开发的课程中呢要用的得自定义的 ... -
ListView的分页显示
2012-01-13 11:22 1204package com.anddev.ListMore.Tes ... -
ProgressBar的圆形和长条形设置
2012-01-12 15:02 0默认的progresbar是圆形的旋转动画: <Pro ... -
把TextView中的文字添加阴影效果及Style的使用
2012-01-12 15:00 2063<TextView android:id=" ... -
GridView动态加载数据情况下,选中状态的实现
2012-01-12 14:57 1451GridView使用AdapterView动态加载数据情况下, ... -
Android中的透明属性的设置
2012-01-12 14:50 1244ui设计时,需要指定某个元素的drawable时,有时候需要告 ... -
简单实现ImageView的加边框颜色的方法
2012-01-12 14:48 2325对于一个ImageView,如果我们要加上边框,比如宽为3dp ... -
Android之PopupWindow弹出对话框
2011-12-03 09:40 4073Android 的 对话框常 ... -
CursorTreeAdapter 详解
2011-12-02 17:44 2179CursorTreeAdapter 通过该适配类可以用一连续的 ... -
Android 应用程序窗体显示状态操作(requestWindowFeature()的应用)
2011-12-02 09:43 753我们在开发程序是经常会需要软件全屏显示、自定义标题(使用按钮等 ... -
Android GestureDetector 手势基础
2011-12-01 16:34 12741. 当用户触摸屏幕的时候,会产生许多手势,例如dow ... -
Android GestureDetector手势识别类
2011-12-01 14:26 2759为了加强鼠标响应事件,Android提供了GestureDet ... -
android之Tabhost深入讲解二
2011-11-29 09:18 2656之前一直认为TabHost不够灵活而使用Activit ... -
android之Tabhost深入讲解一
2011-11-28 21:46 1676大家都知道Tabhost中Tabwidget的布局是图标在上, ... -
Android中的view
2011-11-21 15:02 1144View类是Android的一个超类,这个类几乎包含了所有的屏 ... -
Android自定义View之一:初探实例 .
2011-11-21 14:53 796Android自定义View实现很简单 继承View,重写构 ...
相关推荐
Android ImageView点击选中后添加边框,详细内容可以到我的博客www.heimizhou.com中了解。
对应博文:http://blog.csdn.net/iwanghang/article/details/53763364
Android点击imageview具有缩放效果,在点击事件中进行处理
android自定义ImageView实现旋转动画
android 将Imageview 将view生成图片后保存到本地相册的实现生成图片后保存到本地相册的实现,android 将Imageview生成图片后保存到本地相册的实现 android 将Imageview生成图片后保存到本地相册的实现, 有需要的朋友...
点击图片磁贴效果 很炫.可以玩啊
android自定义ImageView,圆角和圆形,抗锯齿.亲测可用。直接拷贝代码就行。
Popupwindow中图片的缩放,demo里包含了自定义Imageview,可在activity中使用,也是用于图片缩放,提供了现成的自定义view,但未做示例引用。
android demo,imageview的使用的源代码
安卓Android源码——imageView.rar
android 自定义属性实现 ImageView 透明度渐变效果
Android源码——ImageView控件缩放和旋转图片源码.zip
一个Android登录界面的制作范例,以Android dialog方式实现的弹出式登录框,并包括了帐号密码保存、加密算法等模块源码。本登录源码将对密码信息进行AES加密算法加密后保存,有些功能需要服务器配合才能看到,比如...
android ImageView网络图片加载、动态设置尺寸、圆角(绝对好用)
Java源码,Android源码,ImageView Android安卓ImageView ui组件库,并附有相关的测试代码,对ImageView不太熟悉的,不妨参考下,很简单,库代码完整。
(android控件) ImageView 控件开发效果总结 (多组滤镜效果)源码下载
DismissibleImageView 点击ImageView能够扩展至全屏,然后通过拉到屏幕边缘恢复原状
Android平台ImageView拖拽实例,点击ImageView,可随着随着触摸轨迹随意移动,绝对超值。
android 简易圆角ImageView 自带在裁剪
1.Android的自定义ImageView图标,可以根据自己的需要,设置圆形,椭圆形,长方形,正方形图标; 2.都是需要在导入jar包文件后在xml文件中引入<com.hongye.image.image.CircleImageView/> 圆形 ...