1
(即時在Android新) 我試圖添加圓形浮動菜單,但出於一個原因,我忽略詞生成器是紅色的。圓形浮動菜單生成器錯誤
我有這個錯誤: 無法解析符號'Builder' //這個詞生成器在(SubActionButton.Builder(this);)是紅色的。
謝謝您的幫助
// Create an icon
ImageView icon = new ImageView(this);
icon.setImageResource(R.mipmap.ic_launcher);
FloatingActionButton actionButton = new FloatingActionButton.Builder(this)
.setContentView(icon)
.build();
SubActionButton.Builder itemBuilder = new SubActionButton.Builder(this);
// repeat many times:
ImageView itemIcon1 = new ImageView(this);
itemIcon1.setImageResource(R.mipmap.ic_launcher);
ImageView itemIcon2 = new ImageView(this);
itemIcon2.setImageResource(R.mipmap.ic_launcher);
ImageView itemIcon3 = new ImageView(this);
itemIcon3.setImageResource(R.mipmap.ic_launcher);
SubActionButton button1 = itemBuilder.setContentView(itemIcon1).build();
SubActionButton button2 = itemBuilder.setContentView(itemIcon2).build();
SubActionButton button3 = itemBuilder.setContentView(itemIcon3).build();
//attach the sub buttons to the main button
FloatingActionMenu actionMenu = new FloatingActionMenu.Builder(this)
.addSubActionView(button1)
.addSubActionView(button2)
.addSubActionView(button3)
.attachTo(actionButton)
.build();
您是否在使用循環浮動菜單的外部庫? – M090009