80,351
社区成员
发帖
与我相关
我的任务
分享
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="200.0dip"
android:layout_height="wrap_content"
android:background="@drawable/backgroundport"
android:orientation="vertical" >
<ListView
android:id="@+id/lv_popup_accounts"
android:layout_width="200.0dip"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:listSelector="@drawable/list_selector" >
</ListView>
</LinearLayout>
<?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="wrap_content"
android:descendantFocusability="blocksDescendants"
android:padding="5dip" >
<TextView
android:id="@+id/txt_user_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:singleLine="true"
android:text="20101681"
android:textColor="@color/black"
android:textSize="20.0dip" />
<ImageButton
android:id="@+id/txt_user_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="60dip"
android:background="@drawable/btn_delete_user"
android:focusable="false"
android:textSize="15.0dip" />
</LinearLayout>
View moreAccountView = LayoutInflater.from(LoginActivity.this)
.inflate(R.layout.popup_more_account, null);
ListView lvAccounts = (ListView) moreAccountView
.findViewById(R.id.lv_popup_accounts);
ListViewAccountAdapter adapter = new ListViewAccountAdapter(
LoginActivity.this);
lvAccounts.setAdapter(adapter);
lvAccounts.measure(0, 0);
int height = lvAccounts.getMeasuredHeight();
PopupWindow mPopupWindow = new PopupWindow(moreAccountView,
edtAccount.getWidth(), height);
Drawable backgroup = LoginActivity.this.getResources()
.getDrawable(R.drawable.transparent);
mPopupWindow.setBackgroundDrawable(backgroup);
int pos[] = new int[2];
edtAccount.getLocationOnScreen(pos);
mPopupWindow.showAtLocation(edtAccount, Gravity.LEFT
| Gravity.TOP, pos[0], pos[1] + edtAccount.getHeight());