2016-06-15 105 views
1

是否可以从代码中设置晶圆厂的位置?浮动动作按钮的定位

比如我有这2个晶圆厂:

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); 
FloatingActionButton editFab = (FloatingActionButton) findViewById(R.id.editFab); 

“FAB” 是默认的工厂,那当属例子后,我创建一个空白活动和editFab是我的晶圆厂

<android.support.design.widget.FloatingActionButton 
     android:id="@+id/editFab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom" 
     android:layout_margin="16dp" 
     android:clickable="true" 
     /> 

enter image description here

是否可以将“editFab”放在代码的“fab”按钮上方?或者我必须在xml布局中做到这一点?

+0

为什么你想把它放在fab之上?你为什么不用'fab'? –

+2

@jankigadhiya我想要有2个工厂 –

+1

在相对布局中添加晶圆厂,并将其放在您想要的位置。 –

回答