本文整理匯總了Java中android.support.design.widget.FloatingActionButton.setTag方法的典型用法代碼示例。如果您正苦於以下問題:Java FloatingActionButton.setTag方法的具體用法?Java FloatingActionButton.setTag怎麽用?Java FloatingActionButton.setTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.design.widget.FloatingActionButton
的用法示例。
在下文中一共展示了FloatingActionButton.setTag方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
public void init() {
fl = new FrameLayout(getContext());
fl.setTag("aah_fl");
fab = new FloatingActionButton(getContext());
fab.setTag("aah_fab");
fab.setCompatElevation(0);
fl.addView(fab);
this.addView(fl);
}
示例2: addColorButton
import android.support.design.widget.FloatingActionButton; //導入方法依賴的package包/類
private void addColorButton(){
for(int i=0;i<12;i++){
FloatingActionButton floatingActionButton = new FloatingActionButton(CanvasActivity.this);
floatingActionButton.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor(colorArr[i])));
floatingActionButton.setCompatElevation(0);
floatingActionButton.setTag("button");
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(108,108);
params.setMargins(32,0,32,0);
final RelativeLayout relativeLayout = new RelativeLayout(CanvasActivity.this);
relativeLayout.addView(floatingActionButton, params);
relativeLayout.setOnClickListener(this);
if(i == 11){
relativeLayout.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
setDialog((FloatingActionButton) view.findViewWithTag("button"));
relativeLayout.callOnClick();
return true;
}
});
}
if(i > 5){
colorSelectLayout2.addView(relativeLayout, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT));
}else{
colorSelectLayout1.addView(relativeLayout, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT));
}
}
}