Android浮动按钮不正确

时间:2017-06-09 06:19:40

标签: android

我正在使用浮动按钮。我正在使用的图像源也是正确但不确定的同时设置它在中心显示为点。屏幕截图和代码如下:

if let detailVC = storyboard?.instantiateViewController(withIdentifier: "CardDetailVC") as? CardDetailViewController {
        detailVC.cardID = card.key
        navigationController?.pushViewController(detailVC, animated: true)
    }

Floating Button

4 个答案:

答案 0 :(得分:0)

尝试使用

<div>
   <span ng-repeat="image in post.postImages" ng-if="$index <= 3" ng-init="image.showDeleteIcon= false" ng-mouseover="image.showDeleteIcon=true" ng-mouseleave="image.showDeleteIcon=false">
   <span ng-if="$index == 3" ng-init="setImgCounter(post.postImages.length,$parent.$index+''+$index)"></span>
   <a id="{{$parent.$index}}{{$index}}" onclick="SetDataGallery(this.id)" ng-href="../upload/post-photos/{{image.attachmentURL}}">
   <img class="img-responsive feed-photo" ng-src="../upload/post-photos/{{image.attachmentURL}}" alt="Photo" style="display:inline;">
   <a href="#" class="imgDelete" ng-if="post.timelineStrore.hasControl" ng-show="image.showDeleteIcon" title="Delete Photo" ng-click="DeletePostAttachment(post.timelineStrore.id, image.postAttachmentId,'image')">
   <i class="fa fa-close"></i>
   </a>
   </a>
   </span>
</div>

确保您的图标大小为24 X24 dp图标

请参阅this 以获取参考资料

答案 1 :(得分:0)

fabSize可以调整为&#34; mini&#34; &安培; &#34;正常&#34;

<android.support.design.widget.FloatingActionButton
  android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:src="@drawable/ic_done_white_24px"
 app:fabSize="mini"    
 android:scaleType="center"/>

答案 2 :(得分:0)

试试这种工作正常,

<android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_add_cg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        app:elevation="10dp"

        app:borderWidth="0dp"
        app:backgroundTint="#f0f0"
        android:src="@android:drawable/ic_dialog_email"/>

答案 3 :(得分:0)

将最新的支持库添加到您的app build gradle文件并构建您的项目
依赖性{

compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.1'

}

<android.support.design.widget.FloatingActionButton
 android:id="id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:clickable="true"
android:src="@drawable/ic_done_white_24px"
/>