小编Ina*_*mil的帖子

远程通知显示空白

当我在没有远程视图的情况下创建通知时,它工作正常,但是当我尝试使用远程视图时,通知显示空白屏幕.这是我的通知代码: - /

RemoteViews remoteViews = new RemoteViews(getPackageName(),
           R.layout.widget);
    remoteViews.setTextViewText(R.id.date,result);
    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
         this).setSmallIcon(R.drawable.common_signin_btn_icon_dark).setContent(remoteViews);

    Intent resultIntent = new Intent(this, NotificationDatabase.class);
    PendingIntent resultPendingIntent =
            PendingIntent.getActivity(
                    this,
                    0,
                    resultIntent,
                    PendingIntent.FLAG_UPDATE_CURRENT
            );
    mBuilder.setContentIntent(resultPendingIntent);
    NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    // mId allows you to update the notification later on.
    mNotificationManager.notify(1, mBuilder.build());
Run Code Online (Sandbox Code Playgroud)

这是我的widget.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">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/request"
    android:text="NEW APPOINTMENT REQUEST"
    android:textSize="27dp"
    android:layout_marginTop="81dp"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true" />


<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Accept"
    android:id="@+id/accept"
    android:layout_marginLeft="15dp"
    android:layout_below="@+id/request"
    android:layout_alignParentStart="true"
    android:layout_marginTop="61dp" …
Run Code Online (Sandbox Code Playgroud)

android android-notifications android-remoteview

5
推荐指数
0
解决办法
328
查看次数

未找到id'com.android.application'的插件

我是android的新手.我正在使用android studio 1.1.0.当我正在构建我的项目时,它说"错误:(1,0)插件ID为'com.android.application'未找到".我该怎么办?

这是我的"build.gradle"文件 - :\
//顶级构建文件,您可以在其中添加所有子项目/模块共有的配置选项.

buildscript {
    repositories {
       jcenter()
     }
dependencies {
    classpath 'com.android.tools.build:gradle:1.1.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }}

  allprojects {
   repositories {
    jcenter()
    }}
Run Code Online (Sandbox Code Playgroud)

这里是模块'app'的"build.gradle"文件:

  apply plugin: 'com.android.application'

  android {
     compileSdkVersion 22
     buildToolsVersion "22.0.1"

 defaultConfig {
     applicationId "healthcare.prescro.com.prescro"
     minSdkVersion 17
     targetSdkVersion 22
     versionCode 1
     versionName "1.0"
   }
 buildTypes {
     release {
         minifyEnabled false
         proguardFiles getDefaultProguardFile('proguard-android.txt'),   'proguard-rules.pro'
       }
  }}

  dependencies {
      compile fileTree(dir: …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin

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