
对于所有API版本:您可以使用relativeLayout和relativeLayout.Layout.具体地通过在继承自VIEwGroup.marginLayoutParams的字段中设置margins.我想这样会是这样的:
relativeLayout parentLayout = (relativeLayout) findVIEwByID(R.ID.relative_layout);linearLayout newLayout = new linearLayout(this); // or some other layoutrelativeLayout.LayoutParams layoutParams = new relativeLayout.LayoutParams( // You can enter layout absolute dimensions here instead of 'wrap_content'. VIEwGroup.LayoutParams.WRAP_CONTENT,VIEwGroup.LayoutParams.WRAP_CONTENT);// Set your X and Y position here for new layout.layoutParams.setmargins(100 /*left*/,200 /*top*/,0 /*right*/,0 /*bottom*/); parentLayout.addVIEw(newLayout,layoutParams);总结
以上是内存溢出为你收集整理的在我在Android中触摸的点上,在GestureOverlayView中添加一个小孩?全部内容,希望文章能够帮你解决在我在Android中触摸的点上,在GestureOverlayView中添加一个小孩?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)