小编Gok*_* NC的帖子


如何在Bottombar上方显示Snackbar?

我正在使用roughike的BottomBar 2.0:https : //github.com/roughike/BottomBar/

当我显示 SnackBar 时,它会显示在 BottomBar 本身上。

我希望它被绘制在 BottomBar 上方。

活动_main.xml:

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

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/here"
        android:background="#fff">

        <FrameLayout
            android:id="@+id/contentContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/bottomBar">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="Three Buttons Bar"
                android:id="@+id/textView"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true"
                android:textColor="@color/colorPrimary"
                android:textSize="35sp" />

        </FrameLayout>

        <com.roughike.bottombar.BottomBar
            android:id="@+id/bottomBar"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_alignParentBottom="true"
            app:bb_tabXmlResource="@xml/bottombar_tabs" />
    </RelativeLayout>

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

主活动.java:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
        bottomBar.setOnTabSelectListener(new OnTabSelectListener() …
Run Code Online (Sandbox Code Playgroud)

android material-design android-snackbar android-navigation-bar

5
推荐指数
3
解决办法
9748
查看次数

如何在 Windows 上安装带有 libraqm DLL 的预构建枕头轮?

我尝试从这里使用预先构建的轮子Pillow和相应的libraqmDLL:https :
//www.lfd.uci.edu/~gohlke/pythonlibs/#pillow

但以下返回False

from PIL import features
features.check('raqm')
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?

上下文:我需要libraqm使用Pillow图像上的复杂字体,如下所示

python-imaging-library python-wheel

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

如何接收USB连接状态广播?

我正在尝试检测我的应用程序中的USB连接,即USB是否连接到设备。

正在棉花糖6.0.1(sdk23)上进行测试

但是我无法接收广播动作ACTION_USB_DEVICE_ATTACHED或ACTION_USB_DEVICE_DETACHED。

我尝试同时使用动态方式和AndroidManifest.xml方式,但均无效。

这是我的代码:

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.gokulnc.blah_blah"
    android:installLocation="auto"
    android:versionCode="15"
    android:versionName="1.5.1">

    <uses-feature android:name="android.hardware.usb.host" />

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="23" />

    <android:uses-permission android:name="android.permission.USB_PERMISSION" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:vmSafeMode="false">

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/DrawerTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <receiver android:name="mUsbReceiver">
            <intent-filter>
                <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />
            </intent-filter>
            </receiver>
        </activity>        
    </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

MainActivity.java

public class MainActivity extends AppCompatActivity {
    BroadcastReceiver mUsbReceiver;

    public void onCreate(Bundle savedInstanceState) {
        .....
        setBroadcastReceivers();
    }

    void setBroadcastReceivers() { …
Run Code Online (Sandbox Code Playgroud)

android android-intent android-broadcast android-broadcastreceiver

4
推荐指数
2
解决办法
8257
查看次数

如何使用 SSH 使用密码连接到 GCP VM 实例?

我能够使用 SSH 密钥连接到 GCP 中的 VM 实例。我用sudo useradd -m -s /bin/bash -G {groups} {new user name}命令添加了用户,并用 thpasswd {new user name}命令更改了密码。

我尝试使用 SSH 连接到 VM 实例,但收到此错误: Permission denied (publickey).

请帮我。

ssh google-compute-engine google-cloud-platform

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