我的用例是,我有一个表单,其中一些字段是手动填写的,而另一些字段则将用户带到屏幕上,在这个屏幕上,用户可以在大列表中搜索他们想要的值。只接受用户输入的字段工作正常,但是当我试图将属性readOnly = true添加到TextField组合时,会出现以下错误:
None of the following functions can be called with the arguments supplied.
TextField(TextFieldValue, (TextFieldValue) → Unit, Modifier = ..., TextStyle = ..., (() → Unit
我刚刚将撰写版本更新为1.0.0-beta07,它显示了这个运行时错误。
No interface method startRestartGroup(ILjava/lang/String;)Landroidx/compose/runtime/Composer; in class Landroidx/compose/runtime/Composer; or its super classes (declaration of 'androidx.compose.runtime.Composer'
....
at com.google.accompanist.coil.CoilI
我刚刚更新了Jetpack (以及kotlinCompilerExtensionVersion)到1.0.0-beta07,并立即开始在应用程序启动时接收到这个崩溃。降级消除了崩溃。
java.lang.NoSuchMethodError: No interface method startReplaceableGroup(ILjava/lang/String;)V in class Landroidx/compose/runtime/Composer; or its super classes (declaration of 'androidx.compose.runtime.Com
在我的片段中使用撰写时,我得到了这个错误,这在XML的情况下运行得很好
ViewTreeLifecycleOwner not found from androidx.fragment.app.FragmentContainerView
我使用的是单独的活动方法,而不是,使用Jetpack导航组件
活动
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_nav)
supportFragmentM
我正在尝试根据我的需求进行可组合的重新组合,例如:
@Composable
fun recomposeDemo() {
var countState = 0
Recompose { recompose ->
Column //Error in this line
{
Text("CountState is: " + countState)
Button(onClick = { countState++ })
我在代码实验室提供的样本中有一个编译时错误。
这是ViewModel
class VM : ViewModel() {
val isVisible = MutableStateFlow(true).asStateFlow()
}
这就是我想写的:
@Composable
fun Whatever(vm: VM = viewModel()) {
val isVisible by vm.isVisible.collectAsState(true)
// Use is visible here
}
但是,它会产生以下错误:
键入'State<TypeVari
如何在jetpack中创建动态选项卡,在我的应用程序中,我需要显示的选项卡数量取决于API响应。但是,当我设置selectedTabIndex值时,我们需要设置TabsRow值,这将导致问题。因为在加载选项卡数据之前,它试图在没有任何选项卡的情况下构建ui。
请帮我解决这个问题,或者引导我用正确的方式去做。
@Composable
fun CustomTab(viewModel: BeatsViewModel) {
var tabIndex by remember { mutableStateOf(0) }
val beats = viewModel.beatsData.obs
我今天开始学习jetpack compose,当我使用NavHost时,我有一个渲染预览问题 java.lang.IllegalStateException: ViewModels creation is not supported in Preview
at androidx.compose.ui.tooling.ComposeViewAdapter$FakeViewModelStoreOwner$1.getViewModelStore(ComposeViewAdapter.kt:709)
at androidx.navigation.compose.NavHostKt.NavHost(N
我开始使用Jetpack compose (1.0.0-beta07),在使用TextField时遇到了一个非常奇怪的问题。根据所有可能的文档和说明,我做的每件事都是正确的,但是Android Studio经常给我写TextField的消息None of the following functions can be called with the arguments supplied.
下面是我写的代码,Studio仍然在Text (label)和text = it下划线,但我认为它在定义TextField时有问题。当我用"text"替换remember {mutableSta
我想学习android compose。但是,当我想运行我的项目时,我遇到了一个问题,我得到了这个错误。
请帮帮我。我想不通了。
论坛上的许多其他人建议我使用jcenter(),但对我来说仍然不起作用。我做错了吗?
这是我的gradle配置。
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find or
我正在实现表单控件,带有验证等。我希望只有当用户“模糊”TextField时,换句话说,当字段失去焦点时,才会显示错误消息。在Angular中,我们有状态,我们可以从它出发。如何在Jetpack Compose中侦听失去焦点的状态?
@Composable
fun Screen() {
TextField(
onBlur = {
// P.S. This parameter does not exist
}
)
}
我总共有两个屏幕,即SplashScreen和BottomNavScreen(带有底部导航)。BottomNavScreen有两个屏幕,即Screen1和Screen2。
我想从SplashScreen返回到Screen2,但是在导航到SplashScreen时我得到了这个错误。
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.lool, PID: 8610
java.lang.IllegalStateException: ViewModelStore should be set before setGr
在我将Jetpack Compose升级到1.0.0-Beta07之后,在LiveData对象上运行observeAsState时出现以下错误。 java.lang.NoSuchMethodError: No interface method startReplaceableGroup(ILjava/lang/String;)V in class Landroidx/compose/runtime/Composer; or its super classes The documentation说,这个错误在升级时就会出现,为了解决这个问题,必须重新编译依赖于Compose的库。 我不知道该怎
所以,我有一个AlertDialog,里面有一个ListItem,而在里面又有两个TextField:
val keyboardController = LocalSoftwareKeyboardController.current
val focusManager = LocalFocusManager.current
val (nameFieldFocus, valueFieldFocus) = remember{FocusRequester.createRefs()}
AlertDialog(
...
text = {
ListItem(