基本上是一样的吧?它们具有相同的属性。我真的不知道什么时候必须使用每一个。
从技术上讲,Cards 用于卡片视图,但 Surface 具有相同的属性,如elevation和border
android android-jetpack-compose android-compose-card android-jetpack-compose-surface
在我的片段上,我想得到ArrayList<Animal>.我创建了一个newInstance函数.
companion object {
private val ARG_TITLE = "ARG_TITLE"
private val ARG_ANIMALS = "ARG_ANIMALS"
fun newInstance(title: String,animals: ArrayList<Animal>): ExampleFragment{
val fragment = ExampleFragment()
val args = Bundle()
args.putString(ARG_TITLE, title)
args.putSerializable(ARG_ANIMALS, animals)
fragment.arguments = args
return fragment
}
}
Run Code Online (Sandbox Code Playgroud)
在我身上onCreate()我有这个.
private var title: String = ""
lateinit private var animals:ArrayList<Animal>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (arguments != null) {
title = arguments.getString(ARG_TITLE)
animals = arguments.getSerializable(ARG_ANIMALS)
}
}
Run Code Online (Sandbox Code Playgroud)
但
必需:找到ArrayList序列化!
无法转换为ArrayList.
我的提示文本总是可以顶部,好像它是可聚焦的吗?
我试过这个:
<android.support.design.widget.TextInputLayout
android:id="@+id/etSurnameInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/llNameImage"
android:hint="My Hint Text"
app:hintEnabled="true"
app:hintAnimationEnabled="false"
android:textColorHint="@color/gray_title">
Run Code Online (Sandbox Code Playgroud) 我试图模拟我的用例的响应,该用例适用于协程。
fun getData() {
view?.showLoading()
getProductsUseCase.execute(this::onSuccessApi, this::onErrorApi)
}
Run Code Online (Sandbox Code Playgroud)
我的useCase已注入演示者。
GetProductsUseCase具有以下代码:
class GetProductsUseCase (private var productsRepository: ProductsRepository) : UseCase<MutableMap<String, Product>>() {
override suspend fun executeUseCase(): MutableMap<String, Product> {
val products =productsRepository.getProductsFromApi()
return products
}
}
Run Code Online (Sandbox Code Playgroud)
我的BaseUseCase
abstract class UseCase<T> {
abstract suspend fun executeUseCase(): Any
fun execute(
onSuccess: (T) -> Unit,
genericError: () -> Unit) {
GlobalScope.launch {
val result = async {
try {
executeUseCase()
} catch (e: Exception) {
GenericError()
}
}
GlobalScope.launch(Dispatchers.Main) {
when {
result.await() is GenericError …Run Code Online (Sandbox Code Playgroud) 我正在尝试用 Lottie 进行简单的加载。我找到了这个动画: https: //lottiefiles.com/18563-cooking#_= _
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animation_view"
android:layout_width="200dp"
android:layout_height="200dp"
app:lottie_autoPlay="true"
app:lottie_loop="true"
app:lottie_rawRes="@raw/test"
/>
Run Code Online (Sandbox Code Playgroud)
它存储在 SRC/Main/res/raw 中,但我收到此错误:
您必须在加载图像之前设置图像文件夹。使用 LottieComposition#setImagesFolder 或 LottieDrawable#setImagesFolder 设置它
我尝试添加到资产文件夹app:lottie_fileName
所以我认为动画是错误的,因此我想知道是否存在一些工具或命令来知道动画是否有效。
我的视图中有导航控制器.
在我的View Controller中有一个didSelectRowAtIndexPath带开关的方法.在第一个单元格中,我想打开我的新视图"Empresa",我使用这个:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("Empresa")
self.presentViewController(vc, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
和工作,但不是apear导航控制器.像这样查看apear:
android ×6
android-jetpack-compose-surface ×1
fragment ×1
ios ×1
iphone ×1
kotlin ×1
lottie ×1
objective-c ×1
swift ×1
unit-testing ×1