Java 比较一下Android Studio中的布尔人Kotlin
我怎样才能让我的android文本视图生成一个布尔表,因为它在添加Kotlin时给了我一个错误 它没有直接比较布尔值,因为textview不允许我直接使用它来实现生成布尔表的目标Java 比较一下Android Studio中的布尔人Kotlin,java,android,kotlin,Java,Android,Kotlin,我怎样才能让我的android文本视图生成一个布尔表,因为它在添加Kotlin时给了我一个错误 它没有直接比较布尔值,因为textview不允许我直接使用它来实现生成布尔表的目标 package com.example.user.herramientaslogica import android.support.v7.app.AppCompatActivity import android.os.Bundle import android.widget.Button
package com.example.user.herramientaslogica
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import kotlinx.android.synthetic.main.activity_main.*
import org.w3c.dom.Text
import android.text.method.ScrollingMovementMethod
class MainActivity : AppCompatActivity() {
private val VALUES = booleanArrayOf(true, false)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val textview:TextView = findViewById(R.id.textview) as TextView
for (a in VALUES)
{
for (b in VALUES)
{
for (c in VALUES)
for (d in VALUES)
{
for (e in VALUES)
{
for (f in VALUES)
{
textview.setText (a + b + c + d + d + e + f )
)
textview.setMovementMethod(ScrollingMovementMethod())
}
}
}
}
}
}
}
fun or(x:Boolean, y:Boolean):Boolean {
return x || y
}
fun and(x:Boolean, y:Boolean):Boolean {
return x && y
}
fun xor(x:Boolean, y:Boolean):Boolean {
return x xor y
}
fun conditional(x:Boolean, y:Boolean):Boolean {
return !(x && y)
}
fun bicontional(x:Boolean, y:Boolean):Boolean {
return x == y
}
fun disequal(x:Boolean, y:Boolean):Boolean {
return x != y
}
您想要实现什么?实现生成一个与此类似的表,好,那么您想要生成该表。现在,确切的问题是什么?在单个文本视图中如何显示整个表格?无法显示文本视图,为什么我不能直接从文本视图中比较布尔值,为什么生成错误,您知道如何解决吗?@KevinPaúlMontealegreMelo从简单开始,一步一步地进行。。。首先,您要创建一个包含2个布尔值(分别为true和false)的数组;尝试使用Log.d()代码输出,查看其值。。。然后只做一个循环,看看你得到了什么。。。然后继续递增。。。通过阅读你的代码,我不知道你想得到什么,你在同一个数组上有6个嵌套循环。。。