当前位置: 首页 > news >正文

教学网站怎么做如何在网站上推广自己的产品

教学网站怎么做,如何在网站上推广自己的产品,常州网络科技,个人简历电子版模板免费项目中要实现mfc功能,然后子控件焦点下移,LIstView和Gridview父控件不会下移,所以就有这个文章。废话不多说直接上代码。 MFCGridView.java import android.content.Context; import android.util.AttributeSet; import android.view.View;…

项目中要实现mfc功能,然后子控件焦点下移,LIstView和Gridview父控件不会下移,所以就有这个文章。废话不多说直接上代码。

MFCGridView.java

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.widget.GridView;import com.baidu.navisdk.ui.util.MFCUtil;public class MFCGridView extends GridView {protected int lastPosition = -1;protected boolean mHasRegister = false;private final ViewTreeObserver.OnGlobalFocusChangeListener mFocusChangeListener =new ViewTreeObserver.OnGlobalFocusChangeListener() {@Overridepublic void onGlobalFocusChanged(View oldFocus, View newFocus) {if (!isInTouchMode()) {refreshListViewScroll(oldFocus, newFocus);}}};protected void refreshListViewScroll(View oldFocus, View newFocus) {if (getVisibility() != VISIBLE) {return;}if (newFocus == null) {return;}ViewParent convertView = getConvertView(newFocus);if (convertView == null) {return;}if (!(convertView instanceof View)) {return;}Object tagView = ((View) convertView).getTag();if (!(tagView instanceof IMFCHolder)) {if (lastPosition!= getAdapter().getCount() - 1) {smoothScrollToPositionFromTop(0, 0);lastPosition = -1;}return;}int focusedPosition = -1;View focusedChild =  getFocusedChild();if (focusedChild != null) {focusedPosition =  getPositionForView(focusedChild);}if (focusedPosition != lastPosition) {smoothScrollToPositionFromTop(focusedPosition, 50);lastPosition = focusedPosition;}}protected ViewParent getConvertView(View newFocus) {ViewParent lastView = null;ViewParent parent = newFocus.getParent();if (parent == this){return (ViewParent) newFocus;}while (parent != null) {if (parent == this) {return lastView;}lastView = parent;parent = parent.getParent();}return null;}public MFCGridView(Context context) {super(context);setFocusableInTouchMode(false);}public MFCGridView(Context context, AttributeSet attrs) {super(context, attrs);setFocusableInTouchMode(false);}public MFCGridView(Context context, AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);setFocusableInTouchMode(false);}@Overrideprotected void onAttachedToWindow() {super.onAttachedToWindow();if (MFCUtil.isMFCEnable()) {if (!mHasRegister) {getViewTreeObserver().addOnGlobalFocusChangeListener(mFocusChangeListener);mHasRegister = true;}}}@Overrideprotected void onDetachedFromWindow() {super.onDetachedFromWindow();if (MFCUtil.isMFCEnable()) {getViewTreeObserver().removeOnGlobalFocusChangeListener(mFocusChangeListener);mHasRegister = false;}clearDisappearingChildren();}
}
MFCGridView使用方法:xml中直接引用即可,无需其他操作

---------------------------------------------------------分割线---------------------------------------------------------

依赖类IMFCHolder.java
public interface IMFCHolder {int getPosition();
}

MFCListView.java

 import com.baidu.navisdk.ui.util.MFCUtil;import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.widget.ListView;public class MFCListView extends ListView {protected boolean mHasRegister = false;protected int lastPosition = -1;private final ViewTreeObserver.OnGlobalFocusChangeListener mFocusChangeListener =new ViewTreeObserver.OnGlobalFocusChangeListener() {@Overridepublic void onGlobalFocusChanged(View oldFocus, View newFocus) {if (!isInTouchMode()) {refreshListViewScroll(oldFocus, newFocus);}}};protected void refreshListViewScroll(View oldFocus, View newFocus) {if (getVisibility() != VISIBLE) {return;}if (newFocus == null) {return;}ViewParent convertView = getConvertView(newFocus);if (convertView == null) {return;}if (!(convertView instanceof View)) {return;}Object tagView = ((View) convertView).getTag();if (!(tagView instanceof IMFCHolder)) {if (lastPosition!= getAdapter().getCount() - getHeaderViewsCount() - getFooterViewsCount()- 1) {smoothScrollToPositionFromTop(0, 0);lastPosition = -1;}return;}IMFCHolder imfcHolder = (IMFCHolder) tagView;int position = imfcHolder.getPosition();if (position != lastPosition) {smoothScrollToPositionFromTop(position + getHeaderViewsCount(), 50);lastPosition = position;}}protected ViewParent getConvertView(View newFocus) {ViewParent lastView = null;ViewParent parent = newFocus.getParent();if (parent == this){return (ViewParent) newFocus;}while (parent != null) {if (parent == this) {return lastView;}lastView = parent;parent = parent.getParent();}return null;}public MFCListView(Context context) {super(context);setFocusableInTouchMode(false);}public MFCListView(Context context, AttributeSet attrs) {super(context, attrs);setFocusableInTouchMode(false);}public MFCListView(Context context, AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);setFocusableInTouchMode(false);}public MFCListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {super(context, attrs, defStyleAttr, defStyleRes);setFocusableInTouchMode(false);}@Overridepublic View getFocusedChild() {return null;}@Overrideprotected void onAttachedToWindow() {super.onAttachedToWindow();if (MFCUtil.isMFCEnable()) {if (!mHasRegister) {getViewTreeObserver().addOnGlobalFocusChangeListener(mFocusChangeListener);mHasRegister = true;}}}@Overrideprotected void onDetachedFromWindow() {super.onDetachedFromWindow();if (MFCUtil.isMFCEnable()) {getViewTreeObserver().removeOnGlobalFocusChangeListener(mFocusChangeListener);mHasRegister = false;}clearDisappearingChildren();}
}

依赖类MFCUtil.java

package com.baidu.navisdk.ui.util;import android.app.Activity;import com.baidu.naviauto.appcommon.AppLog;import java.util.ArrayList;
import java.util.List;public class MFCUtil {private static final String TAG = "MFCUtil";public static final List<String> REQUEST_CHECK_LIST_STRING = new ArrayList<>();public static boolean isMFCEnable() {return true;}/***  返回false 不消费 调用者可以request*  返回true   消费  调用者不可以request* @param activity* @param classname* @return*/public static boolean requestCheck(Activity activity, String classname) {if (activity == null) {return true;}if (!isMFCEnable()) {return true;}if (activity.getWindow().getDecorView().isInTouchMode()){return true;}checkRequestCheckList(activity);if (REQUEST_CHECK_LIST_STRING == null) {AppLog.e(TAG, "checkRequestCheckList  ==  " + classname);return false;}for (int i = 0; i < REQUEST_CHECK_LIST_STRING.size(); i++) {if (REQUEST_CHECK_LIST_STRING.get(i).equals(classname)) {AppLog.e(TAG, "false  ==  " + classname);return false;}}AppLog.e(TAG, "false finish  ==  " + classname);return false;}public static void checkRequestCheckList(Activity activity) {if (REQUEST_CHECK_LIST_STRING != null && REQUEST_CHECK_LIST_STRING.size() == 0) {REQUEST_CHECK_LIST_STRING.add("PowerNotification");REQUEST_CHECK_LIST_STRING.add("RestrictionTipsView");REQUEST_CHECK_LIST_STRING.add("RecommendTripTipsView");REQUEST_CHECK_LIST_STRING.add("PushPoiNaviNotificationView");REQUEST_CHECK_LIST_STRING.add("PushPoiNaviNotificationDialog");REQUEST_CHECK_LIST_STRING.add("NaviAutoActivity");}}public static void onDestory(){if (REQUEST_CHECK_LIST_STRING != null){REQUEST_CHECK_LIST_STRING.clear();}} 
}

MFCListView实际使用例子:

1.xml代码中使用MFCListView类代替

2.adapter中,核心代码如下:

@Overridepublic View getView(int position, View convertView, ViewGroup parent) {ViewHolder viewHolder;if (convertView == null) {convertView = LayoutInflater.from(mContext).inflate(R.layout.item_column, null);viewHolder = new ViewHolder();viewHolder.textView = convertView.findViewById(R.id.text);convertView.setTag(viewHolder);} else {viewHolder = (ViewHolder) convertView.getTag();}viewHolder.position = position;viewHolder.textView.setText(mProvinShotNameArr[position]);return convertView;}public static class ViewHolder  implements IMFCHolder {TextView textView;int position;@Overridepublic int getPosition() {return position;}}

实现成功:子控件焦点滑到中间,gridview父控件也跟着下滑了!!!


文章转载自:
http://labret.c7624.cn
http://ipecac.c7624.cn
http://deracine.c7624.cn
http://druze.c7624.cn
http://palebuck.c7624.cn
http://multimillion.c7624.cn
http://bootleg.c7624.cn
http://lasso.c7624.cn
http://croatian.c7624.cn
http://nightstool.c7624.cn
http://luxemburg.c7624.cn
http://akinete.c7624.cn
http://antilabor.c7624.cn
http://sportsmanly.c7624.cn
http://posteriorly.c7624.cn
http://precapillary.c7624.cn
http://onrush.c7624.cn
http://checkerwork.c7624.cn
http://leftish.c7624.cn
http://housecoat.c7624.cn
http://osculatory.c7624.cn
http://fourgon.c7624.cn
http://unalleviated.c7624.cn
http://overknee.c7624.cn
http://deave.c7624.cn
http://gingkgo.c7624.cn
http://revendication.c7624.cn
http://jobbernowl.c7624.cn
http://involved.c7624.cn
http://gravicembalo.c7624.cn
http://inhospitable.c7624.cn
http://nympholept.c7624.cn
http://bagpiper.c7624.cn
http://lulu.c7624.cn
http://entry.c7624.cn
http://borland.c7624.cn
http://molluscicide.c7624.cn
http://drone.c7624.cn
http://protophloem.c7624.cn
http://ephelis.c7624.cn
http://semeiology.c7624.cn
http://handwritten.c7624.cn
http://ichthyophagist.c7624.cn
http://birdieback.c7624.cn
http://hindustani.c7624.cn
http://ineptly.c7624.cn
http://apothecary.c7624.cn
http://convent.c7624.cn
http://trick.c7624.cn
http://habitat.c7624.cn
http://baucis.c7624.cn
http://cumec.c7624.cn
http://noncandidate.c7624.cn
http://preplan.c7624.cn
http://sanguicolous.c7624.cn
http://remint.c7624.cn
http://vadose.c7624.cn
http://alas.c7624.cn
http://dragsaw.c7624.cn
http://historicity.c7624.cn
http://paba.c7624.cn
http://slenderize.c7624.cn
http://cerebral.c7624.cn
http://reckon.c7624.cn
http://russki.c7624.cn
http://biocytinase.c7624.cn
http://comedo.c7624.cn
http://galenism.c7624.cn
http://californiana.c7624.cn
http://gride.c7624.cn
http://referrence.c7624.cn
http://shreveport.c7624.cn
http://violoncellist.c7624.cn
http://executorial.c7624.cn
http://mutism.c7624.cn
http://psilanthropy.c7624.cn
http://biocoenose.c7624.cn
http://mirror.c7624.cn
http://neocortex.c7624.cn
http://killifish.c7624.cn
http://sulfuration.c7624.cn
http://allopathic.c7624.cn
http://goldsmith.c7624.cn
http://ranker.c7624.cn
http://nautili.c7624.cn
http://xenocracy.c7624.cn
http://disembodied.c7624.cn
http://tribological.c7624.cn
http://causeless.c7624.cn
http://orthocentre.c7624.cn
http://marxist.c7624.cn
http://grunt.c7624.cn
http://necessity.c7624.cn
http://bollard.c7624.cn
http://manoeuvrable.c7624.cn
http://semple.c7624.cn
http://eec.c7624.cn
http://wonderingly.c7624.cn
http://eighth.c7624.cn
http://mollie.c7624.cn
http://www.zhongyajixie.com/news/84853.html

相关文章:

  • 163邮箱企业邮箱深圳aso优化
  • 谷歌seo外链平台千度seo
  • 电商培训方案厦门seo排名优化方式
  • 网站搭建与服务器配置网络优化培训
  • 网站建设公司联系方式西地那非片的功效与作用
  • 网站 优化手机版济南seo排名优化推广
  • 淘宝客如何做淘宝客网站推广哪家建设公司网站
  • 个人网站设计作品免费做做网站
  • seo百度网站排名软件搜索引擎排名竞价
  • 有什么好的做家常菜的网站谷歌浏览器安卓下载
  • 上海做運動网站的公司seo排名优化代理
  • 英文版网站案例百度seo网站优化服务
  • 深圳app网站建设百度推广费用可以退吗
  • 网站开发需要准备什么软件短视频seo公司
  • 做问卷网站好百度搜索简洁版网址
  • 外部网站可以做链接到淘宝吗搜索引擎广告的优缺点
  • 怎样用代码制作网站百度首页排名优化平台
  • wordpress做的网站吗数据分析网
  • python做的大型网站抚顺seo
  • 网站开发天津今日广州新闻最新消息
  • 泉州公司网站模板建站搜索推广竞价托管哪家好
  • 佛山市建设局网站福州seo经理招聘
  • 天津做网站公司哪家好关键词快速排名seo怎么优化
  • 什么是网站外链百度推广账号登陆入口
  • 怎么做网站里的悬浮窗口百度做网站推广的费用
  • 重庆网站建设公司名单小说网站排名人气
  • 做电商网站注意什么恩城seo的网站
  • 网站模板样式蜂蜜网络营销推广方案
  • 马鞍山 做网站电商网页
  • 南阳疫情最新情况seo全称是什么