我正在使用谷歌cardView支持库来获取我的卡功能.它适用于kitkat和版本,但卡的背景设置为黑色,填充/边距不适用于设备4.1.2.
<android.support.v7.widget.CardView
android:id="@+id/all_goals_card_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:padding="10dp"
app:cardCornerRadius="4dp"
card_view:cardPreventCornerOverlap="false"
card_view:cardBackgroundColor="@android:color/white"
>
</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud) 我在某些手机上收到以下错误日志,如下所示:
原因:输入调度超时(等待发送非键事件,因为触摸的窗口尚未处理超过500.0ms前传递给它的某些输入事件.等待队列长度:20.等待队列头部年龄:5509.1ms.)
我正在使用Retrofit 2进行网络调用,其中我使用异步方法,使用数据库作为领域,我使用异步事务来编写内容.使用Glide进行图像加载.
在使用严格模式时,我发现我得到了共享首选项的惩罚日志.任何其他指向查看和调试问题的指针
我使用日期转换器类来转换我的日期对象.但是,我仍然遇到一个错误说.错误:无法弄清楚如何将此字段保存到数据库中.您可以考虑为其添加类型转换器.
我的日期转换器类
public class DateConverter {
@TypeConverter
public static Date toDate(Long dateLong){
return dateLong == null ? null: new Date(dateLong);
}
@TypeConverter
public static long fromDate(Date date){
return date == null ? null :date.getTime();
}
}
Run Code Online (Sandbox Code Playgroud)
我的数据库表用于使用日期对象.
@Entity(tableName = "userFitnessDailyRecords")
@TypeConverters(DateConverter.class)
public class UserFitnessDailyRecords {
@NonNull
@PrimaryKey(autoGenerate = true)
public int id;
public Date forDay;
public Date getForDay() {
return forDay;
}
public void setForDay(Date forDay) {
this.forDay = forDay;
}
}
Run Code Online (Sandbox Code Playgroud)
我按照谷歌代码持久性实验室的例子和普通软件室各自的GitHub示例.我正在使用房间版本1.0.0.
我正在使用 chrome 自定义选项卡从自定义选项卡的重定向中获取 oAuth 连接请求,我在应用程序中成功重定向。唯一的问题是 chrome 自定义选项卡在重定向时不会关闭,留在堆栈中。
在自定义选项卡中启动 url 的代码如下。
customTabsIntent = new CustomTabsIntent.Builder(mCustomTabsSession)
.setToolbarColor(ContextCompat.getColor(getBaseContext(), R.color.colorPrimary))
.setStartAnimations(getBaseContext(),
R.anim.slide_in_right, R.anim.slide_out_left)
.setExitAnimations(getBaseContext(),
android.R.anim.slide_in_left, android.R.anim.slide_out_right)
.setShowTitle(true)
.build();
customTabsIntent.intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
customTabsIntent.intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
customTabsIntent.launchUrl(Settings_Activity.this, Uri.parse(fitbitUrlBuilder.toString()));
Run Code Online (Sandbox Code Playgroud)
我尝试在清单文件中使用“singleTask”和“singleInstance”,但问题仍然存在。
如果我只使用意图“FLAG_NO_HISTORY”,它就可以工作。但是我需要强制使用“FLAG_ACTIVITY_NEW_TASK”,因为存在某种边缘情况,例如,如果特定站点的令牌被删除,我们尝试重新验证浏览器在 android 7.1 版上崩溃,需要再次手动启动应用程序。
对此的任何帮助表示赞赏。
我的表的结构如下:
@Entity(tableName = "userFitnessDailyRecords")
public class UserFitnessDailyRecords {
@NonNull
@PrimaryKey
private Date forDay;
private int stepCount;
}
Run Code Online (Sandbox Code Playgroud)
我正在编写的用于获取总和和平均值的查询如下:
@Dao
public interface UserFitnessDailyRecordsDao {
@Query("SELECT SUM(stepCount), AVG(stepCount) FROM userFitnessDailyRecords where forDay BETWEEN :startDay AND :endDay ORDER BY forDay ASC")
UserFitnessDailyRecords getUserFitnessSumAndAverageForLastThirtyDays(Date startDay, Date endDay);
@Query("DELETE FROM userFitnessDailyRecords")
void deleteUserFitnessDailyRecord();
}
Run Code Online (Sandbox Code Playgroud)
编译后出现错误,因为列不包含求和和平均值字段,因此无法返回值。在这种情况下,一个收益和平均值如何计算?