View的大小?PopuupWindow应用

ihrthk
领域专家: 操作系统技术领域
2013-01-28 04:44:36
popup_more_account.xml


<?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>


item_account_list.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="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());

我想要的效果就是moreAccountView里多少内容,moreAccountView就有多高,请问怎么实现?

...全文
142 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
ihrthk 2013-01-29
  • 打赏
  • 举报
回复
自顶一下,求解。
内容概要:本文围绕基于交替方向乘子法(ADMM)的多主体综合能源系统分布式协同优化展开研究,提出了一种兼顾系统整体性能与各主体隐私保护的分布式优化框架,并提供了完整的Matlab代码实现。研究详细构建了包含电、热、气等多种能源形式耦合的多主体综合能源系统模型,设计了基于ADMM算法的分布式求解机制,实现了在去中心化架构下的协同优化调度。文中深入分析了算法的迭代流程、收敛条件及关键参数(如惩罚因子)对优化性能的影响,通过仿真实验验证了该方法在提升能源利用效率、促进多能协同、降低运行成本方面的有效性,适用于园区微网、能源互联网等复杂场景下的分布式决策需求。; 适合人群:具备一定优化理论基础和Matlab编程能力的研究生、科研人员及从事综合能源系统、智能电网、分布式能源管理等相关领域的工程技术人员。; 使用场景及目标:①实现多主体综合能源系统中电、热、气等多能流的协同调度与优化运行;②解决传统集中式优化带来的数据隐私泄露和计算负担过重问题,支持去中心化的分布式决策模式;③为能源互联网、智慧园区、微电网等实际应用场景提供可复现、易拓展的算法原型与技术参考。; 阅读建议:建议读者结合所提供的Matlab代码进行动手实践,重点理解ADMM算法中增广拉格朗日函数的构造、变量更新规则及收敛判据的实现过程,关注惩罚参数设置对算法收敛速度与稳定性的影响,可进一步尝试将其拓展应用于其他分布式优化问题或与其他智能算法进行性能对比研究。

80,488

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧