2016-11-28 3 views
1

screenshot of fab buttons in xml Я использую библиотеку «com.github.clans: fab: 1.6.4», чтобы показать фабричные кнопки, они работают правильно, но когда я попытался изменить изображения для кнопок то изображения кажутся очень маленькими, и изображение кнопки меню ресторана вообще не изменилось. Может ли кто-нибудь сказать мне, как решить эту проблему?Как изменить меню кнопок меню изображения в android

здесь код XML:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:fab="http://schemas.android.com/apk/res-auto" 
android:orientation="vertical"> 

<HorizontalScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:fillViewport="true" 
    android:scrollbars="none" > 
    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     android:layout_weight="1" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true"> 

     <TableLayout 
      android:layout_marginTop="10dp" 
      android:id="@+id/tabla_cuerpo" 
      android:layout_width="match_parent" 
      android:layout_height="362dp"> 

      <TableRow 
       android:id="@+id/tableRow1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:background="#BCBCBC"> 

       <TextView 
        android:id="@+id/textView1a" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="#BCBCBC"    android:padding="5dp" 
        android:text="Case#" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 

       <TextView 
        android:id="@+id/textView1b" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="#BCBCBC"    android:padding="5dp" 
        android:text="Client" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 

       <TextView 
        android:id="@+id/textView1c" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="#BCBCBC"    android:padding="5dp" 
        android:text="Case Amount" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
       <TextView 
        android:id="@+id/textView1d" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="#BCBCBC"    android:padding="5dp" 
        android:text="Received" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
       <TextView 
        android:id="@+id/textView1e" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="#BCBCBC"    android:padding="5dp" 
        android:text="Reminder" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
       <TextView 
        android:id="@+id/textView1f" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="#BCBCBC"    android:padding="5dp" 
        android:text="Remarks" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 

      </TableRow> 

      <TableRow 
       android:id="@+id/tableRow2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

        <TextView 

       android:id="@+id/textView2a" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@drawable/cellshape" 
       android:padding="5dp" 
       android:text="Case#" 
       android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 

       <TextView 
        android:id="@+id/textView2b" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Client" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 

       <TextView 
        android:id="@+id/textView2c" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Case Amount" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
       <TextView 
        android:id="@+id/textView2d" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Received" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
       <TextView 
        android:id="@+id/textView2e" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Reminder" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
       <TextView 
        android:id="@+id/textView2f" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Remarks" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
      </TableRow> 
      <TableRow 
       android:id="@+id/tableRow3" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <TextView 

        android:id="@+id/textView3a" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Case#" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 

       <TextView 
        android:id="@+id/textView3b" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Client" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 

       <TextView 
        android:id="@+id/textView3c" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Case Amount" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
       <TextView 
        android:id="@+id/textView3d" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Received" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
       <TextView 
        android:id="@+id/textView3e" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Reminder" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
       <TextView 
        android:id="@+id/textView3f" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:background="@drawable/cellshape" 
        android:padding="5dp" 
        android:text="Remarks" 
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView> 
      </TableRow> 

     </TableLayout> 

    </LinearLayout> 
</HorizontalScrollView> 

<FrameLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <com.github.clans.fab.FloatingActionMenu 
     android:id="@+id/fab_menu" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:paddingBottom="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     fab:menu_backgroundColor="#ccffffff" 
     fab:fab_colorNormal="#DA4336" 
     fab:fab_colorPressed="#E75043" 
     fab:fab_colorRipple="#99FFFFFF" 
     fab:fab_showShadow="true" 
     fab:menu_labels_colorNormal="#333333" 
     fab:menu_labels_colorPressed="#444444" 
     fab:menu_labels_colorRipple="#66FFFFFF" 
     fab:menu_labels_showShadow="true" 
     fab:menu_labels_maxLines="-1" 
     fab:menu_labels_position="left" 
     fab:menu_openDirection="up" 
     fab:fab_shadowColor="#66000000" 
     fab:menu_labels_ellipsize="end" 
     fab:menu_labels_singleLine="true"> 

     <com.github.clans.fab.FloatingActionButton 
      android:id="@+id/fab2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/add_payment_btn" 
      fab:fab_label="ADD PAYMENT" 
      fab:fab_size="mini" /> 

     <com.github.clans.fab.FloatingActionButton 
      android:id="@+id/fab3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/editcasesicon" 
      fab:fab_label="EDIT PAYMENT" 
      fab:fab_size="mini" /> 

    </com.github.clans.fab.FloatingActionMenu> 
</FrameLayout> 

<ImageButton 
    android:id="@+id/imageButton1" 
    android:layout_width="60dp" 
    android:layout_height="60dp" 
    android:background="@drawable/delete" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_marginLeft="30dp" 
    android:layout_marginBottom="21dp" 
    /> 
</RelativeLayout> 
+0

Сообщите свой xml-код, если это возможно. –

+0

@sathishgadde, пожалуйста, уточните мой обновленный вопрос – Annie

ответ

0

Am просто использовал ту же библиотеку .СА вашего вытяжки размера как высоту 24dp и 24dp width.am опубликовать мой образец кода экран shot.i надеюсь, что это может полезно для вы.

Вы не используете оба и за один раз используете только один FloatingActionButton. В противном случае повышайте ошибку при объявлении управления [FloatingActionButton]. enter image description here enter image description here

Если вы хотите chnage FloatingActionMenu изображение, то вы можете изменить Drawable изображения из вашей библиотеки проекта, открытого FloatingActionMenu.class и из этого файла линии нет. 161 измените свое изображение, выбирая все, что захотите.

+0

Нет, ваш ответ неправильный, так как это не работает – Annie

+0

Извините, вы сказали, что «изображения кажутся очень маленькими, а изображение кнопки меню ресторана вообще не изменилось». Ваш код прав. Но вы просто измените заводское меню с возможностью рисования [Image] размер изменился как Высота: 24dp и вес: 24dp –

+0

И скажите, какой образ вы хотите изменить. –

Смежные вопросы