我有一个空的数组列表:
var mylist: ArrayList<Int> = ArrayList()
Run Code Online (Sandbox Code Playgroud)
当我想在其中设置值时,我收到此错误:
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
Run Code Online (Sandbox Code Playgroud)
问题是:我如何初始化我的清单?
我有这个代码用于更改标签布局文本的颜色,但它根本不起作用!
app:tabTextColor 不起作用,它不能改变颜色为白色.
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:tabIndicatorColor="@color/blue"
app:tabIndicatorHeight="5dp"
app:tabTextColor="@color/white" />
Run Code Online (Sandbox Code Playgroud) 这是我的代码:
var header1: Record? = null
var header2: Record? = null
header2 = header1
header2.name = "new_name"
Run Code Online (Sandbox Code Playgroud)
但也有header1.name变化!
我想在我的 kotlin 应用程序中初始化套接字 IO。
我的问题在这里:
private var mSocket: Socket? = null
{
try {
mSocket = IO.socket("http://chat.socket.io")
} catch (URISyntaxException e) {
}
}
Run Code Online (Sandbox Code Playgroud)
导入 com.github.nkzawa.socketio.client.IO
认不出来