邊框加圓角
<div id="menu_card">
test
</br>
test
</div>
#menu_card {
margin-bottom: 30px;
-moz-border-radius: 4px;
/*Gecko(Firefox内核)浏览器圆角样式*/
-webkit-border-radius: 4px;
/*webkit(Chrome内核)浏览器圆角样式*/
border-radius: 4px;
/*Trident(IE内核)浏览器圆角样式*/
/*margin: 10px*/
}
使用了div導致footer沒有在底部顯示,解決辦法:
http://blog.csdn.net/frank0712105003/article/details/38170873
http://ryanfait.com/resources/footer-stick-to-bottom-of-page/
<html>
<head>
<link rel="stylesheet" href="layout.css" ... />
</head>
<body>
<div class="wrapper">
<p>Your website content here.</p>
<div class="push"></div>
</div>
<div class="footer">
<p>Copyright (c) 2008</p>
</div>
</body>
</html>
css:
.footer, .push {
clear: both;
}
andriod viewgroup中根據xy坐標獲取子view,這個工具能獲取子viewgroup的view(多重都可以獲取,xy是touch event中getX getY獲取的)
/**
* 視圖工具
* Created by george.yang on 2015/11/30.
*/
public class ViewUtil {
/**
* 根据坐标获取相对应的子控件
* 在Activity使用
* @param activity
* @param x
* @param y
* @return
*/
public static View getViewAtActivity(Activity activity,int x, int y) {
// 从Activity里获取容器
ViewGroup root = (ViewGroup) activity.getWindow().getDecorView();
return getViewAtViewGroup(root,x, y);
}
final static int[] tempXY = new int[2];
/**
* 根据坐标获取相对应的子控件<br>
* 在重写ViewGroup使用
* @param vg
* @param x of toucg.getX()
* @param y of touch.getY()
* @return
*/
public static View getViewAtViewGroup(ViewGroup vg,int x, int y) {
synchronized (tempXY) {
vg.getLocationInWindow(tempXY);
return getViewAtViewGroupExec(vg,x,y);
}
}
private static View getViewAtViewGroupExec(ViewGroup vg,int x, int y) {
View subView = null;
for (int i=0;i<vg.getChildCount();i++) {
View view = vg.getChildAt(i);
if (view instanceof ViewGroup) {
subView = getViewAtViewGroupExec((ViewGroup)view,x,y);
if (subView!=null) {
break;
}
} else {
if (isPointInViewOnActivity(view,tempXY[0]+x,tempXY[1]+y)) {
return view;
}
}
}
return subView;
}
private static boolean isPointInViewOnActivity(View view, int x, int y) {
int[] winXY = new int[2];
view.getLocationInWindow(winXY);
int startX = winXY[0];
int endX = startX + view.getMeasuredWidth();
int startY = winXY[1];
int endY = startY + view.getMeasuredHeight();
if (x>=startX && x<=endX && y >= startY && y<= endY) {
return true;
}
return false;
}