标签: background

如何在Swift中将背景图像添加到UICollectionViewCell?

我曾经假设将背景图像添加到a中很容易UICollectionViewCell,但是我很难搞清楚它.我有一个这样的边框图像,我想添加到我的每个单元格中UICollectionView.

border.png

在此输入图像描述

我看不到在Interface Builder中添加它的选项,我不确定在UICollectionViewCell编程上使用哪种方法.

我见过这些类似的问题:

background image ios uicollectionviewcell swift

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

快速NSTimer在背景中

关于如何在堆栈或其他地方处理背景中的NSTimer,我遇到了很多问题.我已经尝试了其中一个实际上有意义的选项..当应用程序进入后台时停止计时器

    NSNotificationCenter.defaultCenter().addObserver(self, selector: "appDidEnterBackground", name: UIApplicationDidEnterBackgroundNotification, object: nil)
Run Code Online (Sandbox Code Playgroud)

    NSNotificationCenter.defaultCenter().addObserver(self, selector: "appDidBecomeActive", name: UIApplicationWillEnterForegroundNotification, object: nil)
Run Code Online (Sandbox Code Playgroud)

起初我认为我的问题已经解决了,我只是节省了应用程序进入后台的时间并计算了应用程序进入前景时的差异..但后来我注意到时间实际上推迟了3,4,5秒.它实际上是不一样的..我把它与另一台设备上的秒表进行了比较.

真的有任何SOLID解决方案在后台运行NSTimer吗?

background nstimer ios swift

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

android RecyclerView BackgroundColor

当我使用RecyclerView在我的应用程序中显示列表数据时,RecyclerView的backgroundcolor始终为白色:

截图

我在xml文件和代码中设置backgroundcolor,但它不起作用:

//activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:orientation="vertical"
    android:background="@color/colorPrimary">
    <!--<include layout="@layout/content_main" />-->
    <FrameLayout
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"></FrameLayout>
</LinearLayout>

//fragment_layout.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"
    android:background="@color/colorAccent">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/list_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorAccent"
        android:padding="5dp" />
</RelativeLayout>

//item_layout.xml
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp"
    card_view:cardBackgroundColor="@color/yellow"
    card_view:cardCornerRadius="1dp">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="5dp">

        <TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="5dip"
            android:layout_marginTop="5dip"
            android:gravity="center"
            android:textColor="@color/text_white"
            android:textSize="@dimen/list_item_text_size" />

        <ImageView
            android:id="@+id/pic"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/name"
            android:scaleType="centerCrop" />
    </RelativeLayout>

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


    //gradle file
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId …
Run Code Online (Sandbox Code Playgroud)

android background android-recyclerview

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

当app在后台时,将纬度和经度发送到服务器

我已经经历了这么多链接,即使在那之后我还没有找到适当的解决方案来获取经度和经度.

定期iOS后台位置更新

iOS长时间运行的后台计时器,带有"位置"后台模式

我尝试从一些链接和论坛,但它只工作3分钟,然后应用程序根本没有更新用户位置.

- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.


//create new uiBackgroundTask
__block UIBackgroundTaskIdentifier bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
    [app endBackgroundTask:bgTask];
    bgTask = UIBackgroundTaskInvalid;
}];

//and create new timer with async …
Run Code Online (Sandbox Code Playgroud)

background core-location nstimer ios

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

背景:和背景图像之间的差异:

快速简单的问题在下面的外部CSS页面示例中;

body {
  background-image: url(background.jpg);
}
header {
  background: url(background.jpg);
}
Run Code Online (Sandbox Code Playgroud)

我知道他们正在影响不同的元素选择器,我的问题是使用背景与背景图像有什么区别?是否可以访问另一个特定属性?谢谢,麻烦您了.

css background between background-image difference

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

iOS:如何检测UIApplicationDelegate状态何时变为“挂起”?

我们如何检测iOS应用何时被暂停

UIApplicationDelegate官方文档中没有提及此方法。

这些是应用程序可以具有的状态:


(来源:apple.com

用例:

我想记录由于位置事件而唤醒应用后停止运行的时间。例如,我有一个iBeacon,该应用程序正在跟踪。我激活了iBeacon,该应用程序在后台成功启动(持续10秒钟)。我想,当应用程序停止运行这10秒钟后,检测经过。但是,似乎没有AppDelegate方法允许拦截此事件(请考虑我正在调查此特定情况。

上一个问题: 我问过一个类似的问题,但没有得到回答。请在这里找到它。

background objective-c uiapplicationdelegate ios ibeacon

3
推荐指数
2
解决办法
1031
查看次数

进入Suspended状态后,将调用AppDelegate的哪种方法?

我的应用程序进入后台,如果我再次打开,它显示我离开它的同一页面.

虽然,如果iOS将应用程序置于Suspended状态,但它在内存中.如果我回来,将调用哪些AppDelegate方法.

实际上我的目的是将同一屏幕从暂停恢复到应用程序,如果它没有终止.

最后,如果App从SUSPENDED状态返回,将调用Will didFinishLaunchWithOptions.

谢谢..

lifecycle background ios

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

我想用kotlin在android中单击Button后更改背景

我想在点击按钮后更改背景

   var bm : Button = messeg
    bm . setOnClickListener {
        bm . background = R.color.green
    }
Run Code Online (Sandbox Code Playgroud)

错误日志:

错误:(35,31)类型不匹配:推断类型是Int但可绘制!预计错误:任务':app:compileDebugKotlin'的执行失败.

编译错误.有关详细信息,请参阅日志

android background button kotlin

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

如何制作CSS背景网格线

img


背景有四行。它们在整个部分中可见,但在图像上不可见。

怎么做?

css background css3

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

Xcode 9后台获取方案

为了在Xcode 8模拟器中测试背景提取,我们可以复制我们当前的构建方案,并在"运行 - >选项"窗格中勾选"后台提取☑️由于后台提取事件而启动"的框.

我在Xcode 9中找不到这个.有什么想法吗?

xcode background fetch ios xcode9

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