悬浮透明框
来源:互联网 发布:简历淘宝美工工作描述 编辑:程序博客网 时间:2024/05/17 13:14
1.
locationAddDemo();
2.
private void locationAddDemo() {itemList = new ArrayList<String>();itemList.add("图片动态");itemList.add("视频动态");RelativeLayout locationAddDemoLayout = (RelativeLayout) LayoutInflater.from(MessageBoardMainActivity.this).inflate(R.layout.friend_adds, null);ListView rootcategory = (ListView) locationAddDemoLayout.findViewById(R.id.rootcategory);RelativeLayout popupLayout = (RelativeLayout) locationAddDemoLayout.findViewById(R.id.popup_layout);MessageBoardMainAddsListAdapter messageBoardMainAddsListAdapter = new MessageBoardMainAddsListAdapter(MessageBoardMainActivity.this,itemList);rootcategory.setAdapter(messageBoardMainAddsListAdapter);mPopWin = new PopupWindow(locationAddDemoLayout, RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT, true);mPopWin.setBackgroundDrawable(new BitmapDrawable());mPopWin.showAtLocation(messageboard_main_play, Gravity.RIGHT, 20, -620);mPopWin.update();popupLayout.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {mPopWin.dismiss();}});rootcategory.setOnItemClickListener(new AdapterView.OnItemClickListener() {@Overridepublic void onItemClick(AdapterView<?> parent, View view, int position, long id) {if(position==0){Intent i = new Intent(MessageBoardMainActivity.this,MeDynamicAddActivity.class);startActivityForResult(i, 1);}else if(position==1){}mPopWin.dismiss();}});}
3.
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/popup_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/transparent" > <RelativeLayout android:layout_width="130dp" android:layout_height="wrap_content" android:background="@color/transparent" android:layout_centerVertical="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true"> <ListView android:id="@+id/rootcategory" android:layout_width="130dp" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:background="#b0454545" android:divider="@null" android:scrollbars="vertical" /> </RelativeLayout></RelativeLayout>
4.
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/categoryadapter_layout" android:layout_width="fill_parent" android:layout_height="40dp" > <ImageView android:id="@+id/f_imageView" android:layout_width="20dp" android:layout_height="20dp" android:layout_alignParentLeft="true" android:layout_marginBottom="5dp" android:layout_marginLeft="15dp" android:layout_marginTop="5dp" android:layout_centerVertical="true" android:contentDescription="@string/sub_image" /> <TextView android:id="@+id/f_name" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_marginLeft="8dp" android:layout_marginRight="15dp" android:layout_centerVertical="true" android:layout_toRightOf="@+id/f_imageView" android:drawablePadding="3dp" android:gravity="center_vertical" android:textColor="@color/white" android:textSize="15sp" /> <View android:id="@+id/f_view" android:layout_width="fill_parent" android:layout_height="0.1dp" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_alignParentBottom="true" android:background="@color/white" /></RelativeLayout>6.
public class MessageBoardMainAddsListAdapter extends BaseAdapter {private Context context;private ArrayList<String> itemList;public MessageBoardMainAddsListAdapter(Context context, List<String> itemList) {this.context = context;this.itemList = (ArrayList<String>) itemList;}@Overridepublic int getCount() {return itemList.size();}@Overridepublic Object getItem(int position) {return itemList.get(position);}@Overridepublic long getItemId(int position) {return position;}@Overridepublic View getView(int position, View convertView, ViewGroup parent) {ViewHolder viewHolder = null;if (convertView == null) {viewHolder = new ViewHolder();convertView = LayoutInflater.from(context).inflate(R.layout.friend_adds_item, null);viewHolder.mNameTextView = (TextView) convertView.findViewById(R.id.f_name);viewHolder.ImageView01 = (ImageView) convertView.findViewById(R.id.f_imageView);viewHolder.f_view = convertView.findViewById(R.id.f_view);//viewHolder.categoryadapter_layout = (RelativeLayout) convertView.findViewById(R.id.categoryadapter_layout);convertView.setTag(viewHolder);} else {viewHolder = (ViewHolder) convertView.getTag();}String mainName = itemList.get(position);viewHolder.mNameTextView.setText(mainName);if (position == 0) {viewHolder.ImageView01.setBackgroundResource(R.drawable.image_add);viewHolder.f_view.setVisibility(View.VISIBLE);} else if (position == 1) {viewHolder.ImageView01.setBackgroundResource(R.drawable.vedio_add);viewHolder.f_view.setVisibility(View.INVISIBLE);}return convertView;}class ViewHolder {public TextView mNameTextView;public ImageView ImageView01;//public RelativeLayout categoryadapter_layout;public View f_view;}}
阅读全文
0 0
- 悬浮透明框
- 悬浮框
- 悬浮框
- 悬浮框
- Silverlight 置于悬浮层之下 背景透明的方法
- android中实现透明悬浮的PopupWindow效果
- Android定制透明悬浮StatusBar 多分辨率适配
- Android悬浮框应用--悬浮笔记
- [Javascript]右侧悬浮框
- 标题悬浮提示框
- Android 桌面悬浮框
- div悬浮提示框
- Android 桌面悬浮框
- Extjs添加悬浮框
- jquery悬浮提示框
- Android桌面悬浮框
- android 悬浮框
- 网站 图片 悬浮框
- 简单框架使用
- 【css】浏览器私有属性前缀使用详解
- 01--机器学习之决策树
- 推荐学习方法——费曼技巧,以教促学,教学相长
- JAVA中的Session
- 悬浮透明框
- poj 3468 小白算法练习 a simple problem with integers 线段树
- Python函数的参数
- Android 三类动画
- PyCharm Professional 2016 破解
- 一些常规形几何形状的绘制和效果填充(一)
- PAT B1043. 输出PATest
- 2017暑假训练第一场的一些题目
- 网络流基础算法模板