在hitomis / circlemenu中增加图标大小

时间:2016-11-19 10:40:47

标签: android android-custom-view android-menu android-icons

我正在使用Hitomis/CircleMenu在onclick上显示社交媒体图标和社交媒体活动的意图。

它的默认图标大小太小了,我想增加图标大小。

我的代码:

class SmartXCUICoordinate
{
    let element: XCUIElement
    let normalizedOffset: CGVector

    init(element: XCUIElement, normalizedOffset offset: CGVector) {
        self.element = element
        self.normalizedOffset = offset
    }

    var realCoordinate: XCUICoordinate {
        guard XCUIDevice.shared().orientation.isLandscape else {
            return element.coordinate(withNormalizedOffset: normalizedOffset)
        }

        let app = XCUIApplication()
        _ = app.isHittable // force new UI hierarchy snapshot

        let screenPoint = element.coordinate(withNormalizedOffset: normalizedOffset).screenPoint

        let portraitScreenPoint = XCUIDevice.shared().orientation == .landscapeLeft
            ? CGVector(dx: app.frame.width - screenPoint.y, dy: screenPoint.x)
            : CGVector(dx: screenPoint.y, dy: app.frame.height - screenPoint.x)

        return app
            .coordinate(withNormalizedOffset: CGVector.zero)
            .withOffset(portraitScreenPoint)
    }

    func tap() {
        realCoordinate.tap()  // wrap other XCUICoordinate methods as needed
    }
}

extension XCUIElement
{
    func smartCoordinate(withNormalizedOffset normalizedOffset: CGVector) -> SmartXCUICoordinate {
        return SmartXCUICoordinate(element: self, normalizedOffset: normalizedOffset)
    }
}

3 个答案:

答案 0 :(得分:0)

要增加图标大小,您需要使用最新的库引用(1.0.2)

 compile 'com.github.Hitomis:CircleMenu:v1.0.2'

并更改circlemenu的width属性

 <com.hitomi.cmlibrary.CircleMenu
    android:id="@+id/circle_menu"
    android:layout_width="450dp"
    android:layout_height="match_parent"
    android:layout_centerInParent="true"
    />

答案 1 :(得分:0)

如果增加比例X并缩放Y尺寸。它似乎增加了整个菜单的大小。这是代码:

<com.hitomi.cmlibrary.CircleMenu
android:id="@+id/circle_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:scaleX="2.0"
android:scaleY="2.0"
android:gravity="center_horizontal"/>

Click here to see result

答案 2 :(得分:0)

item.push