小编Aug*_*nta的帖子

在golang上写在热敏打印机设备上

我已经在我的linux机器上配置了热敏打印机(ESC/POS)并使用终端命令(作为root)我可以打印它:

echo "Hello!" > /dev/usb/lp0
Run Code Online (Sandbox Code Playgroud)

但是,在golang中执行相同的过程没有任何反应:

package main

import (
    "fmt"
    "os"
)

func main() {
   fmt.Println("Hello Would!")

   f, err := os.Open("/dev/usb/lp0")

   if err != nil {
       panic(err)
   }

   defer f.Close()

   f.Write([]byte("Hello world!"))
}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

linux thermal-printer go

1
推荐指数
1
解决办法
522
查看次数

AHBottomNavigation 总是在 FloatingActionButton 前面

我正在尝试在底部导航菜单顶部创建一个带有 FAB 的布局,但菜单始终位于按钮上方。:(

我的layout.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/container"
    tools:context="com.example.mytest.money.MainActivity">

    <android.support.v7.widget.CardView
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card_view"
        android:layout_width="match_parent"
        android:layout_margin="10dp"
        android:layout_height="110dp"
        android:padding="15dp"
        card_view:cardElevation="2dp"
        card_view:cardCornerRadius="4dp">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="Test" />

    </android.support.v7.widget.CardView>

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/bottom_navigation"
        android:layout_alignParentTop="true"
        android:foreground="@color/colorBackground">
    </ScrollView>

    <com.aurelhubert.ahbottomnavigation.AHBottomNavigation
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:selectedBackgroundVisible="false"
        android:layout_gravity="bottom" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/create_gain_expense"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|center"
        android:layout_margin="15dp"
        android:layout_above="@id/bottom_navigation"
        android:src="@drawable/ic_add_white_24dp"
        app:fabSize="normal" />

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

我的期望:

期待

我得到了什么:

现实

我能做些什么来改变这种情况?:D

android android-layout

0
推荐指数
1
解决办法
1406
查看次数

标签 统计

android ×1

android-layout ×1

go ×1

linux ×1

thermal-printer ×1