小编enl*_*now的帖子

style属性不使用android:namespace前缀的原因

在Android中,style属性不使用android:namespace前缀的原因是什么?

看看怎么style不开始android:?谁知道为什么?

<TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="I Love Android!"
        style="@android:style/TextAppearance.Large"
        />
Run Code Online (Sandbox Code Playgroud)

http://developer.android.com/guide/topics/ui/themes.html

谢谢!

xml android xsd

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

Kotlin同步inine

是否知道你不能在Kotlin中同步内联函数?我找不到任何关于此的文件.

想象一下,你有一个同步方法的类;

/**
 * Allows modifying the value in a synchronized way so that the get() and set() are atomic.
 *
 * Note: anything synchronized cannot be `inline`.
 */
@Synchronized fun safeSet(calculateNewValue: (T) -> T) {
    set(calculateNewValue(get()))
}
Run Code Online (Sandbox Code Playgroud)

当这个功能是inlined这个测试失败时,它不inlined通过.

@Test
fun `safeSet - is synchronized`() {
    val insideSet = AtomicInteger()
    val threadsRun = CountDownLatch(2)
    val t1 = Thread({
        threadsRun.countDown()
        sut.safeSet { currentValue: Int ->
            insideSet.incrementAndGet()
            try {
                Thread.sleep(100000)
            } catch (interrupted: InterruptedException) {
                BoseLog.debug(interrupted)
            }
            currentValue …
Run Code Online (Sandbox Code Playgroud)

kotlin

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

标签 统计

android ×1

kotlin ×1

xml ×1

xsd ×1