當前位置: 首頁>>代碼示例>>Java>>正文


Java View.setClickable方法代碼示例

本文整理匯總了Java中android.view.View.setClickable方法的典型用法代碼示例。如果您正苦於以下問題:Java View.setClickable方法的具體用法?Java View.setClickable怎麽用?Java View.setClickable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.setClickable方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBindViewHolder

import android.view.View; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    holder.itemView.setClickable(false);    // disable parent click

    //Loop through all the ThemeViews
    for(WidgetTheme widgetTheme : WidgetTheme.values()) {
        final String name = widgetTheme.name();
        final int themeViewId = widgetTheme.getThemeViewId();
        final int summaryRes = widgetTheme.getSummaryRes();

        View button = holder.findViewById(themeViewId);
        button.setClickable(true);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setSummary(summaryRes);
                persistString(name);
            }
        });
    }
}
 
開發者ID:abicelis,項目名稱:PingWidget,代碼行數:23,代碼來源:ThemePreference.java

示例2: MyViewHolder

import android.view.View; //導入方法依賴的package包/類
public MyViewHolder(View itemView) {
    super(itemView);
    itemView.setClickable(true);
    layoutBackground = (LinearLayout) itemView.findViewById(R.id.main_background_view);
    layoutMain = (LinearLayout) itemView.findViewById(R.id.main_view);
    layoutDueDate = (LinearLayout) itemView.findViewById(R.id.layout_duedate);
    layoutLabel = (LinearLayout) itemView.findViewById(R.id.layout_label);
    layoutReminder = (LinearLayout) itemView.findViewById(R.id.layout_reminder);
    todoItem = (TextView) itemView.findViewById(R.id.todoTask);
    todoLabel = (TextView) itemView.findViewById(R.id.todoLabel);
    todoDueDate = (TextView) itemView.findViewById(R.id.todoDueDate);
    todoReminder = (TextView) itemView.findViewById(R.id.todoTime);
    iconLabel = (ImageView) itemView.findViewById(R.id.iconLabel);
}
 
開發者ID:OlayinkaPeter,項目名稱:Toodoo,代碼行數:15,代碼來源:ToodooListAdapter.java

示例3: onActivityCreated

import android.view.View; //導入方法依賴的package包/類
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    getVisibleDelegate().onActivityCreated(savedInstanceState);

    View view = mFragment.getView();
    if (view != null) {
        view.setClickable(true);
        setBackground(view);
    }

    if (savedInstanceState != null
            || mRootStatus == STATUS_ROOT_ANIM_DISABLE
            || (mFragment.getTag() != null && mFragment.getTag().startsWith("android:switcher:"))
            || (mReplaceMode && !mFirstCreateView)) {
        notifyEnterAnimEnd();
    } else if (mCustomEnterAnim != Integer.MIN_VALUE) {
        fixAnimationListener(mCustomEnterAnim == 0 ?
                mAnimHelper.getNoneAnim() : AnimationUtils.loadAnimation(_mActivity, mCustomEnterAnim));
    }

    if (mFirstCreateView) {
        mFirstCreateView = false;
    }
}
 
開發者ID:wzx54321,項目名稱:XinFramework,代碼行數:24,代碼來源:SupportFragmentDelegate.java

示例4: onBindView

import android.view.View; //導入方法依賴的package包/類
@Override
protected void onBindView(View view) {
    super.onBindView(view);

    View button = view.findViewById(R.id.preference_click_target);
    button.setClickable(true);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (getOnPreferenceClickListener() != null) {
                getOnPreferenceClickListener().onPreferenceClick(TextAndButtonPreference.this);
            }
        }
    });
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:16,代碼來源:TextAndButtonPreference.java

示例5: repopulateItems

import android.view.View; //導入方法依賴的package包/類
private void repopulateItems() {
  if (mPreference == null || mColorGrid == null) {
    return;
  }

  Context context = mColorGrid.getContext();
  mColorGrid.removeAllViews();
  for (final int color : mPreference.mColorChoices) {
    View itemView = LayoutInflater.from(context)
                                  .inflate(R.layout.color_preference_item, mColorGrid, false);

    setColorViewValue(itemView.findViewById(R.id.color_view), color,
                      color == mPreference.getValue());
    itemView.setClickable(true);
    itemView.setFocusable(true);
    itemView.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View view) {
        mPreference.setValue(color);
        dismiss();
      }
    });

    mColorGrid.addView(itemView);
  }

  sizeDialog();
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:29,代碼來源:ColorPreference.java

示例6: addView

import android.view.View; //導入方法依賴的package包/類
@Override
public void addView(@NonNull View child, int index, ViewGroup.LayoutParams params) {
  super.addView(child, index, params);

  if (getChildCount() == 1) {
    current = child;
    child.setVisibility(View.VISIBLE);
  } else {
    child.setVisibility(View.GONE);
  }
  child.setClickable(false);
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:13,代碼來源:AnimatingToggle.java

示例7: ViewHolder

import android.view.View; //導入方法依賴的package包/類
public ViewHolder(View itemView, int viewType, Context c) {
    super(itemView);

    itemView.setClickable(true);
    ivContactImage = (ImageView) itemView.findViewById(R.id.ivContactImage);
    tvContactName = (TextView) itemView.findViewById(R.id.tvContactName);
}
 
開發者ID:StringflowServer,項目名稱:Beach-Android,代碼行數:8,代碼來源:ContactAdapter.java

示例8: onChildAttachedToWindow

import android.view.View; //導入方法依賴的package包/類
@Override
public void onChildAttachedToWindow(View child) {
    super.onChildAttachedToWindow(child);
    if (!ViewCompat.hasOnClickListeners(child)) {
        child.setClickable(true);
        child.setOnClickListener(mOnItemOperateListenerInternalInternal);
    }
    child.setOnLongClickListener(mOnItemOperateListenerInternalInternal);
}
 
開發者ID:littleloulou,項目名稱:PullToRefreshRecyclerView,代碼行數:10,代碼來源:PullToRefreshRecyclerView.java

示例9: createBaseViewHolder

import android.view.View; //導入方法依賴的package包/類
@NonNull
@Override
protected RBaseViewHolder createBaseViewHolder(int viewType, View itemView) {
    if (itemView instanceof SwipeRecycleViewItemLayout) {

    } else {
        SwipeRecycleViewItemLayout swipeRecycleViewItemLayout = new SwipeRecycleViewItemLayout(mContext);
        itemView.setClickable(true);//防止穿透內容布局, 直接點到了menu上
        swipeRecycleViewItemLayout.addView(itemView);
        swipeRecycleViewItemLayout.setLayoutParams(itemView.getLayoutParams());

        itemView = swipeRecycleViewItemLayout;
    }
    return super.createBaseViewHolder(viewType, itemView);
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:16,代碼來源:RBaseSwipeAdapter.java

示例10: onMeasure

import android.view.View; //導入方法依賴的package包/類
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    //令自己可點擊,從而獲取觸摸事件
    setClickable(true);
    //由於ViewHolder的複用機製,每次這裏要手動恢複初始值
    mRightMenuWidths = 0;
    mHeight = 0;
    //適配GridLayoutManager,將以第一個子Item(即ContentItem)的寬度為控件寬度
    int contentWidth = 0;
    int childCount = getChildCount();
    //為了子View的高,可以matchParent(參考的FrameLayout 和LinearLayout的Horizontal)
    final boolean measureMatchParentChildren = MeasureSpec.getMode(heightMeasureSpec) != MeasureSpec.EXACTLY;
    boolean isNeedMeasureChildHeight = false;
    for (int i = 0; i < childCount; i++) {
        View childView = getChildAt(i);
        //令每一個子View可點擊,從而獲取觸摸事件
        childView.setClickable(true);
        if (childView.getVisibility() != GONE) {
            //後續計劃加入上滑、下滑,則將不再支持Item的margin
            measureChild(childView, widthMeasureSpec, heightMeasureSpec);
            //measureChildWithMargins(childView, widthMeasureSpec, 0, heightMeasureSpec, 0);
            final MarginLayoutParams lp = (MarginLayoutParams) childView.getLayoutParams();
            mHeight = Math.max(mHeight, childView.getMeasuredHeight());
            if (measureMatchParentChildren && lp.height == ViewGroup.LayoutParams.MATCH_PARENT) {
                isNeedMeasureChildHeight = true;
            }
            if (i > 0) {
                //第一個布局是Left item,從第二個開始才是RightMenu
                mRightMenuWidths += childView.getMeasuredWidth();
            } else {
                mContentView = childView;
                contentWidth = childView.getMeasuredWidth();
            }
        }
    }

    //寬度取第一個Item(Content)的寬度
    setMeasuredDimension(getPaddingLeft() + getPaddingRight() + contentWidth,
            mHeight + getPaddingTop() + getPaddingBottom());
    //滑動判斷的臨界值
    mLimit = mRightMenuWidths * 4 / 10;
    //如果子View的height有MatchParent屬性的,設置子View高度
    if (isNeedMeasureChildHeight) {
        forceUniformHeight(childCount, widthMeasureSpec);
    }
}
 
開發者ID:yedashen,項目名稱:UltimateRecyclerView,代碼行數:48,代碼來源:SwipeItem.java

示例11: disableUserInteractions

import android.view.View; //導入方法依賴的package包/類
/**
 * Disables user interactions for a view and all it's subviews.
 */
private void disableUserInteractions(View view) {
  view.setClickable(false);
  if (view instanceof ViewGroup) {
    ViewGroup viewGroup = (ViewGroup)view;
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
      disableUserInteractions(viewGroup.getChildAt(i));
    }
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:13,代碼來源:LayoutAnimationController.java

示例12: configureHeader

import android.view.View; //導入方法依賴的package包/類
/**
 * Get a header view. This optionally pulls a header from the supplied
 * {@link WrapperView} and will also recycle the divider if it exists.
 */
private View configureHeader(WrapperView wv, final int position) {
	View header = wv.mHeader == null ? popHeader() : wv.mHeader;
	header = mDelegate.getHeaderView(position, header, wv);
	if (header == null) {
		throw new NullPointerException("Header view must not be null.");
	}
	//if the header isn't clickable, the listselector will be drawn on top of the header
	header.setClickable(true);
	header.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View v) {
			if(mOnHeaderClickListener != null){
				long headerId = mDelegate.getHeaderId(position);
				mOnHeaderClickListener.onHeaderClick(v, position, headerId);
			}
		}
	});
	return header;
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:25,代碼來源:AdapterWrapper.java

示例13: _setTabLayoutCanClick

import android.view.View; //導入方法依賴的package包/類
/**
 * 控製 TabLayout 點擊使能
 * @param canClick
 */
private void _setTabLayoutCanClick(boolean canClick){
    LinearLayout tabStrip= (LinearLayout) mTabLayout.getChildAt(0);
    for (int i = 0; i < tabStrip.getChildCount(); i++) {
        View tabView = tabStrip.getChildAt(i);
        if(tabView !=null){
            tabView.setClickable(canClick);
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:DownloadActivity.java

示例14: clearClickable

import android.view.View; //導入方法依賴的package包/類
private static void clearClickable(View view) {
    view.setOnClickListener(null);
    view.setBackgroundResource(0);
    view.setClickable(false);
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:6,代碼來源:MyScheduleAdapter.java

示例15: applyClickable

import android.view.View; //導入方法依賴的package包/類
/**
 * apply clickable in view
 */
public static void applyClickable(View view, DynamicProperty property) {
    if (view != null) {
        switch (property.type) {
            case BOOLEAN: {
                view.setClickable(property.getValueBoolean());
            }
            break;
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:DynamicHelper.java


注:本文中的android.view.View.setClickable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。