近期項目比較忙,今日纔有時間給你們分享android的一些實用的知識~javascript
android中一種獲取view座標的方法,獲取在當前窗口內的絕對座標。
int[] location = new int[2] ;
view.getLocationInWindow(location);
解釋:
location[0] -----> x座標
location[1] -----> y座標java
android中獲取view座標的方法有兩種:android
在onCreate裏面調用,會獲得location[0]和location[1]的值均爲空,這是由於UI控件還沒加載好的緣由。因此咱們能夠使用view.post(runnable)方法去獲取或者在onWindowFocusChanged(boolean hasFocus)方法中獲取。git
案例效果圖以下:github
首先咱們須要保存頂部Tab滑動各item寬度座標,代碼以下:api
/** * 保存症狀詳情頂部tab橫向寬度座標 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param * @return */
private void saveSymptomDetailHorizontalWidth() {
int[] location = new int[2];
for (int i = 0; i < symptomDetailContainerLy.getChildCount(); i++) {
getSingleNavigation(i).getLocationInWindow(location);
symptomDetailHorizontalWidth[i] = location[0];
}
}複製代碼
而後保存症狀詳情滑動高度座標,代碼以下:網絡
/** * 保存症狀詳情滑動高度座標 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param * @return */
private void savesymtomDetailScvHeight() {
// 症狀詳情
final int[] symptomModuleLoc = new int[2];
final int[] symptomLocation = new int[2];
// 症狀模塊
symptomModuleLy.post(new Runnable() {
@Override
public void run() {
symptomModuleLy.getLocationInWindow(symptomModuleLoc);
symtomDetailScvHeight[0] = 0;
}
});
// 病因模塊
pathogenyModuleLy.post(new Runnable() {
@Override
public void run() {
pathogenyModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[1] = symptomLocation[1] - symptomModuleLoc[1];
}
});
// 檢查模塊
checkoutModuleLy.post(new Runnable() {
@Override
public void run() {
checkoutModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[2] = symptomLocation[1] - symptomModuleLoc[1];
}
});
// 診斷模塊
diagnoseModuleLy.post(new Runnable() {
@Override
public void run() {
diagnoseModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[3] = symptomLocation[1] -symptomModuleLoc[1];
}
});
// 預防模塊
preventModuleLy.post(new Runnable() {
@Override
public void run() {
preventModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[4] = symptomLocation[1] - symptomModuleLoc[1];
}
});
foodTreatModuleLy.post(new Runnable() {
@Override
public void run() {
// 食療模塊
foodTreatModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[5] = symptomLocation[1] - symptomModuleLoc[1];
}
});
}複製代碼
接着設置滑動監聽、點擊頂部Tab事件,代碼以下:ide
/** * 症狀詳情頂部tab橫向監聽 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param * @return */
class OnSymtomHorizontalScClickedListener implements View.OnClickListener {
@Override
public void onClick(View view) {
isTopClick = true;
setSymtomHorizontalCurrentPostion(view, true, 0, 0);
}
}
@Override
protected void registerListener() {
// 退出當前頁面
findViewById(R.id.iv_actionbar_back).setOnClickListener(this);
// 設置滑動監聽
if (symptomDetailScv != null)
symptomDetailScv.setScrollViewListener(new ObservableScrollView.ScrollViewListener() {
@Override
public void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy, int oritention) {
if (isTopClick) {
isTopClick = false;
return;
}
// 症狀詳情
// 若是症狀詳情頂部tab橫向寬度座標或者症狀詳情滑動高度座標則返回
if (symtomDetailScvHeight == null || symptomDetailHorizontalWidth == null)
return;
if (y >= symtomDetailScvHeight[0] && y < symtomDetailScvHeight[1]) {
// 症狀
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(0),
false, symptomDetailHorizontalWidth[0], y);
} else if (y >= symtomDetailScvHeight[1] && y < symtomDetailScvHeight[2]) {
// 病因
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(1),
false, symptomDetailHorizontalWidth[1], y);
} else if (y >= symtomDetailScvHeight[2] && y < symtomDetailScvHeight[3]) {
// 檢查
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(2),
false, symptomDetailHorizontalWidth[2], y);
} else if (y >= symtomDetailScvHeight[3] && y < symtomDetailScvHeight[4]) {
// 診斷
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(3),
false, symptomDetailHorizontalWidth[3], y);
} else if (y >= symtomDetailScvHeight[4] && y < symtomDetailScvHeight[5]) {
// 預防
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(4),
false, symptomDetailHorizontalWidth[4], y);
} else if (y >= symtomDetailScvHeight[5]) {
// 食療
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(5),
false, symptomDetailHorizontalWidth[5], y);
}
}
});
}複製代碼
最後設置頂部Tab位置,代碼以下:佈局
/** * 設置症狀詳情頂部tab位置 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param view * @param fromClick 是否點擊 * @param x x座標 * @param y y座標 * @return */
public void setSymtomHorizontalCurrentPostion(View view, boolean fromClick, int x, int y){
// 若是不是點擊事件並橫向滑動控件不爲空則滑動到指定座標
if (!fromClick && symptomDetailHscv != null) {
symptomDetailHscv.scrollTo(x, y);
}
if (view == null){
return;
}
if (view.getTag() == null)
return;
// 獲取當前位置
int position = (Integer) view.getTag();
// 若是當前位置非上次位置
if (lastPosition != position){
// 若是頂部tab動態加載容器爲空,則從新實例化
if (symptomDetailContainerLy == null) {
// 頂部tab動態加載容器
symptomDetailContainerLy = (LinearLayout) findViewById(R.id.ly_symptom_detail_container);
}
// 設置上次位置藍色下滑線不可見
getNavigationImageView(lastPosition).setVisibility(View.INVISIBLE);
// 設置上次位置字體顏色爲黑色
getNavigationTextView(lastPosition).setTextColor(
getResources().getColor(R.color.text_color_black));
// 設置當前位置藍色下劃線可見
getNavigationImageView(position).setVisibility(View.VISIBLE);
// 設置當前位置字體顏色爲藍色
getNavigationTextView(position).setTextColor(
getResources().getColor(R.color.title_color));
}
lastPosition = position;
if (symptomDetailScv != null && fromClick) {
symptomDetailScv.scrollTo(0, symtomDetailScvHeight[position]);
}
}複製代碼
症狀詳情頁面完整代碼以下:post
package cn.jianke.getlocationinwindowdemo.module.activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import cn.jianke.getlocationinwindowdemo.R;
import cn.jianke.getlocationinwindowdemo.httprequest.ApiCallback;
import cn.jianke.getlocationinwindowdemo.httprequest.api.ApiSymptomDetail;
import cn.jianke.getlocationinwindowdemo.httprequest.httpresponse.SymptomDetailResponse;
import cn.jianke.getlocationinwindowdemo.module.util.HTMLSpirit;
import cn.jianke.getlocationinwindowdemo.module.util.StringUtil;
import cn.jianke.getlocationinwindowdemo.module.util.Unicode2String;
import cn.jianke.getlocationinwindowdemo.module.widget.ObservableScrollView;
import static cn.jianke.getlocationinwindowdemo.module.activity.MainActivity.SYMPTOM_ID;
/** * @className: SymptomDetailActivity * @classDescription: 症狀詳情 * @author: leibing * @createTime: 2016/10/29 */
public class SymptomDetailActivity extends BaseActivity implements View.OnClickListener{
// 症狀id
private String id = "";
// 頂部橫向滑動控件
private HorizontalScrollView symptomDetailHscv;
// 頂部tab動態加載容器
private LinearLayout symptomDetailContainerLy;
// 滑動控件
private ObservableScrollView symptomDetailScv;
// 症狀模塊
private LinearLayout symptomModuleLy;
// 症狀標題
private TextView symptomTitleTv;
// 症狀內容
private TextView symptomContentTv;
// 病因模塊
private LinearLayout pathogenyModuleLy;
// 病因內容
private TextView pathogenyContentTv;
// 檢查模塊
private LinearLayout checkoutModuleLy;
// 檢查內容
private TextView checkoutContentTv;
// 診斷模塊
private LinearLayout diagnoseModuleLy;
// 診斷內容
private TextView diagnoseContentTv;
// 預防模塊
private LinearLayout preventModuleLy;
// 預防內容
private TextView preventContentTv;
// 食療模塊
private LinearLayout foodTreatModuleLy;
// 食療內容
private TextView foodTreatContentTv;
// 症狀詳情數據
private SymptomDetailResponse symptomDetailResponse;
// 症狀詳情頂部tab橫向寬度座標
private final int[] symptomDetailHorizontalWidth = new int[6];
// 症狀詳情滑動高度座標
private final int[] symtomDetailScvHeight = new int[6];
// 是否頂部點擊事件
private boolean isTopClick = false;
// 上次點擊點頂部tab item的位置
private int lastPosition = 0;
// 症狀詳情api
private ApiSymptomDetail mApiSymptomDetail;
@Override
protected void setContentView() {
// 指定佈局
setContentView(R.layout.activity_symptom_detail);
}
@Override
protected void initView() {
// 滑動控件
symptomDetailScv = (ObservableScrollView) findViewById(R.id.scv_symptom_detail);
// 頂部橫向滑動控件
symptomDetailHscv = (HorizontalScrollView) findViewById(R.id.hscv_symptom_detail);
// 頂部tab動態加載容器
symptomDetailContainerLy = (LinearLayout) findViewById(R.id.ly_symptom_detail_container);
// 症狀模塊
symptomModuleLy = (LinearLayout) findViewById(R.id.ly_symptom_module);
// 症狀標題
symptomTitleTv = (TextView) findViewById(R.id.tv_symptom_title);
// 症狀內容
symptomContentTv = (TextView) findViewById(R.id.tv_symptom_content);
// 病因模塊
pathogenyModuleLy = (LinearLayout) findViewById(R.id.ly_pathogeny_module);
// 病因內容
pathogenyContentTv = (TextView) findViewById(R.id.tv_pathogeny_content);
// 檢查模塊
checkoutModuleLy = (LinearLayout) findViewById(R.id.ly_checkout_module);
// 檢查內容
checkoutContentTv = (TextView) findViewById(R.id.tv_checkout_content);
// 診斷模塊
diagnoseModuleLy = (LinearLayout) findViewById(R.id.ly_diagnose_module);
// 診斷內容
diagnoseContentTv = (TextView) findViewById(R.id.tv_diagnose_content);
// 預防模塊
preventModuleLy = (LinearLayout) findViewById(R.id.ly_prevent_module);
// 預防內容
preventContentTv = (TextView) findViewById(R.id.tv_prevent_content);
// 食療模塊
foodTreatModuleLy = (LinearLayout) findViewById(R.id.ly_food_treat_module);
// 食療內容
foodTreatContentTv = (TextView) findViewById(R.id.tv_food_treat_content);
// 獲取意圖傳值
getIntentData();
// 初始化症狀詳情api
mApiSymptomDetail = new ApiSymptomDetail();
// 初始化症狀詳情頂部tab
initSymptomDetailHorizontalTab();
}
@Override
protected void registerListener() {
// 退出當前頁面
findViewById(R.id.iv_actionbar_back).setOnClickListener(this);
// 設置滑動監聽
if (symptomDetailScv != null)
symptomDetailScv.setScrollViewListener(new ObservableScrollView.ScrollViewListener() {
@Override
public void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy, int oritention) {
if (isTopClick) {
isTopClick = false;
return;
}
// 症狀詳情
// 若是症狀詳情頂部tab橫向寬度座標或者症狀詳情滑動高度座標則返回
if (symtomDetailScvHeight == null || symptomDetailHorizontalWidth == null)
return;
if (y >= symtomDetailScvHeight[0] && y < symtomDetailScvHeight[1]) {
// 症狀
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(0),
false, symptomDetailHorizontalWidth[0], y);
} else if (y >= symtomDetailScvHeight[1] && y < symtomDetailScvHeight[2]) {
// 病因
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(1),
false, symptomDetailHorizontalWidth[1], y);
} else if (y >= symtomDetailScvHeight[2] && y < symtomDetailScvHeight[3]) {
// 檢查
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(2),
false, symptomDetailHorizontalWidth[2], y);
} else if (y >= symtomDetailScvHeight[3] && y < symtomDetailScvHeight[4]) {
// 診斷
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(3),
false, symptomDetailHorizontalWidth[3], y);
} else if (y >= symtomDetailScvHeight[4] && y < symtomDetailScvHeight[5]) {
// 預防
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(4),
false, symptomDetailHorizontalWidth[4], y);
} else if (y >= symtomDetailScvHeight[5]) {
// 食療
setSymtomHorizontalCurrentPostion(symptomDetailContainerLy.getChildAt(5),
false, symptomDetailHorizontalWidth[5], y);
}
}
});
}
@Override
protected void getData() {
if (mApiSymptomDetail != null){
// 請求數據
mApiSymptomDetail.getSymptomDetail(id, SymptomDetailActivity.this,
new ApiCallback<SymptomDetailResponse>() {
@Override
public void onSuccess(SymptomDetailResponse response) {
// 更新UI
updateSymptomUI(response);
}
@Override
public void onError(String err_msg) {
Toast.makeText(SymptomDetailActivity.this,
err_msg, Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure() {
Toast.makeText(SymptomDetailActivity.this,
"網絡不給力", Toast.LENGTH_SHORT).show();
}
});
}
}
/** * 更新症狀詳情UI * @author leibing * @createTime 2016/10/08 * @lastModify 2016/10/08 * @param response 症狀詳情數據 * @return */
private void updateSymptomUI(SymptomDetailResponse response) {
// 更新症狀詳情數據
symptomDetailResponse = response;
// 症狀
if (StringUtil.isNotEmpty(symptomDetailResponse.namecn)
&& StringUtil.isNotEmpty(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.summarize)))){
// 症狀標題
symptomTitleTv.setText(symptomDetailResponse.namecn);
// 症狀內容
symptomContentTv.setText(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.summarize)));
}
if (StringUtil.isNotEmpty(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.pathogeny)))){
// 病因內容
pathogenyContentTv.setText(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.pathogeny)));
}
if (StringUtil.isNotEmpty(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.diagnoses)))){
// 檢查內容
checkoutContentTv.setText(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.diagnoses)));
}
if (StringUtil.isNotEmpty(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.differential)))){
// 診斷內容
diagnoseContentTv.setText(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.differential)));
}
if (StringUtil.isNotEmpty(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.prevent)))){
// 預防內容
preventContentTv.setText(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.prevent)));
}
if (StringUtil.isNotEmpty(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.foodtreat)))){
// 食療內容
foodTreatContentTv.setText(HTMLSpirit.removeHtmlTag(
Unicode2String.decodeUnicode(symptomDetailResponse.foodtreat)));
}
// 設置高度和寬度
savesymtomDetailScvHeight();
saveSymptomDetailHorizontalWidth();
}
/** * 獲取意圖傳值 * @author leibing * @createTime 2016/10/29 * @lastModify 2016/10/29 * @param * @return */
private void getIntentData() {
// 獲取意圖傳值
Bundle bundle = getIntent().getExtras();
if (bundle != null){
// 症狀id
id = bundle.getString(SYMPTOM_ID, "");
}
}
/** * 初始化症狀詳情頂部tab * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param * @return */
private void initSymptomDetailHorizontalTab() {
// 獲取頂部滑動item名稱
String[] array = getResources().getStringArray(
R.array.symptom_detail_navigation_name);
// 初始化監聽
OnSymtomHorizontalScClickedListener listener = new OnSymtomHorizontalScClickedListener();
for (int i = 0; i < array.length; i++) {
// 獲取子view
View childView = LayoutInflater.from(SymptomDetailActivity.this).inflate(
R.layout.check_details_single_navigation_model, null);
// 實例化子view控件
TextView titleTv = (TextView)
childView.findViewById(R.id.check_details_navigation_textView);
// 給子view控件初始化值
titleTv.setText(array[i]);
// 子view設置tag
childView.setTag(i);
// 子view設置監聽
childView.setOnClickListener(listener);
// 子view添加到父容器
symptomDetailContainerLy.addView(childView);
}
// 默認爲選中第一個
getNavigationImageView(0).setVisibility(View.VISIBLE);
getNavigationTextView(0).setTextColor(
getResources().getColor(R.color.title_color));
}
/** * 設置症狀詳情頂部tab位置 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param view * @param fromClick 是否點擊 * @param x x座標 * @param y y座標 * @return */
public void setSymtomHorizontalCurrentPostion(View view, boolean fromClick, int x, int y){
// 若是不是點擊事件並橫向滑動控件不爲空則滑動到指定座標
if (!fromClick && symptomDetailHscv != null) {
symptomDetailHscv.scrollTo(x, y);
}
if (view == null){
return;
}
if (view.getTag() == null)
return;
// 獲取當前位置
int position = (Integer) view.getTag();
// 若是當前位置非上次位置
if (lastPosition != position){
// 若是頂部tab動態加載容器爲空,則從新實例化
if (symptomDetailContainerLy == null) {
// 頂部tab動態加載容器
symptomDetailContainerLy = (LinearLayout) findViewById(R.id.ly_symptom_detail_container);
}
// 設置上次位置藍色下滑線不可見
getNavigationImageView(lastPosition).setVisibility(View.INVISIBLE);
// 設置上次位置字體顏色爲黑色
getNavigationTextView(lastPosition).setTextColor(
getResources().getColor(R.color.text_color_black));
// 設置當前位置藍色下劃線可見
getNavigationImageView(position).setVisibility(View.VISIBLE);
// 設置當前位置字體顏色爲藍色
getNavigationTextView(position).setTextColor(
getResources().getColor(R.color.title_color));
}
lastPosition = position;
if (symptomDetailScv != null && fromClick) {
symptomDetailScv.scrollTo(0, symtomDetailScvHeight[position]);
}
}
/** * 保存症狀詳情頂部tab橫向寬度座標 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param * @return */
private void saveSymptomDetailHorizontalWidth() {
int[] location = new int[2];
for (int i = 0; i < symptomDetailContainerLy.getChildCount(); i++) {
getSingleNavigation(i).getLocationInWindow(location);
symptomDetailHorizontalWidth[i] = location[0];
}
}
/** * 保存症狀詳情滑動高度座標 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param * @return */
private void savesymtomDetailScvHeight() {
// 症狀詳情
final int[] symptomModuleLoc = new int[2];
final int[] symptomLocation = new int[2];
// 症狀模塊
symptomModuleLy.post(new Runnable() {
@Override
public void run() {
symptomModuleLy.getLocationInWindow(symptomModuleLoc);
symtomDetailScvHeight[0] = 0;
}
});
// 病因模塊
pathogenyModuleLy.post(new Runnable() {
@Override
public void run() {
pathogenyModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[1] = symptomLocation[1] - symptomModuleLoc[1];
}
});
// 檢查模塊
checkoutModuleLy.post(new Runnable() {
@Override
public void run() {
checkoutModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[2] = symptomLocation[1] - symptomModuleLoc[1];
}
});
// 診斷模塊
diagnoseModuleLy.post(new Runnable() {
@Override
public void run() {
diagnoseModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[3] = symptomLocation[1] -symptomModuleLoc[1];
}
});
// 預防模塊
preventModuleLy.post(new Runnable() {
@Override
public void run() {
preventModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[4] = symptomLocation[1] - symptomModuleLoc[1];
}
});
foodTreatModuleLy.post(new Runnable() {
@Override
public void run() {
// 食療模塊
foodTreatModuleLy.getLocationInWindow(symptomLocation);
symtomDetailScvHeight[5] = symptomLocation[1] - symptomModuleLoc[1];
}
});
}
/** * 症狀詳情頂部tab橫向監聽 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param * @return */
class OnSymtomHorizontalScClickedListener implements View.OnClickListener {
@Override
public void onClick(View view) {
isTopClick = true;
setSymtomHorizontalCurrentPostion(view, true, 0, 0);
}
}
/** * 根據索引獲取頂部滑動欄TextView實例 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param index 索引值 * @return */
private TextView getNavigationTextView(int index) {
if (symptomDetailContainerLy == null)
return null;
return (TextView) symptomDetailContainerLy.getChildAt(index).findViewById(
R.id.check_details_navigation_textView);
}
/** * 根據索引獲取頂部滑動欄ImageView實例 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param index 索引值 * @return */
private ImageView getNavigationImageView(int index) {
if (symptomDetailContainerLy == null)
return null;
return (ImageView) symptomDetailContainerLy.getChildAt(index).findViewById(
R.id.check_details_navigation_imageView);
}
/** * 根據索引獲取頂部滑動欄View實例 * @author leibing * @createTime 2016/10/19 * @lastModify 2016/10/19 * @param index 索引值 * @return */
private View getSingleNavigation(int index) {
if (symptomDetailContainerLy == null)
return null;
return symptomDetailContainerLy.getChildAt(index);
}
@Override
public void onClick(View view) {
switch (view.getId()){
case R.id.iv_actionbar_back:
// 退出當前頁面
this.finish();
break;
default:
break;
}
}
}複製代碼
項目地址:LocationInWindow