小编Nor*_*rik的帖子

实现的 iOS AppIntents 不显示在快捷方式中

我正在尝试测试当前 iOS16 Beta 上的新 AppIntents API。查看文档,实现似乎非常简单,但实现后,我在快捷方式应用程序中没有看到我的 AppIntent。该设备运行的是 iOS 16.0。

这就是我实现 AppIntent 的方式:


import AppIntents

struct DoSomethingIntent: AppIntent {
    
    static var title: LocalizedStringResource = "This will do something"
    
    static var description = IntentDescription("Does something")
    
    func perform() async throws -> some PerformResult {
        return .finished(value: "Done")
    }
}

Run Code Online (Sandbox Code Playgroud)

根据文档,快捷方式应用程序应该能够在安装我的应用程序后找到我的 AppIntent,但我发现情况并非如此。有谁知道我的实施缺少什么?

ios ios16 appintents

9
推荐指数
2
解决办法
2490
查看次数

在ViewPager中更改碎片时,使用Elevation闪烁创建的阴影

我对使用的阴影有问题Elevation.

我的屏幕包含一个ViewPager4个不同的Fragments和一个TabLayout用于导航.第一个和最后一个片段都包含一个RecyclerViewCardView元素填充的片段.每当我在第1页和第4页之间切换时,CardView元素下方的阴影首先出现在它们的位置之外,并在大约半秒钟过后突然进入正确的位置.

这仅在切换中的非相邻片段之间发生ViewPager.如果我按顺序从1到4移动,则不会发生这种情况.

具有Elevation集合的每个其他元素都有这个问题,而不仅仅是CardView.

我的ViewPager实现:

mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
mViewPager = (NoSwipeViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
mViewPager.setOffscreenPageLimit(4);
tabLayout.setupWithViewPager(mViewPager);
Run Code Online (Sandbox Code Playgroud)

RecyclerView中使用的CardView之一

<android.support.v7.widget.CardView
        style="@style/Custom.CarView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardUseCompatPadding="true" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/post_image"
            android:layout_width="match_parent"
            android:layout_height="179dp"
            android:layout_gravity="center"
            android:scaleType="centerCrop"
            app:imageUrl="@{photo.avatar_url}"
            tools:background="@color/com_facebook_blue" />

        <Button
            android:id="@+id/edit_item_imageView"
            style="@style/Widget.AppCompat.Button.Borderless"
            android:layout_width="29dp"
            android:layout_height="37dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:background="@android:color/transparent" />

        <ImageView
            android:id="@+id/image_edit"
            android:layout_width="12dp"
            android:layout_height="24dp"
            android:layout_alignParentRight="true"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:src="@drawable/profile_post_options" />

        <TextView
            android:id="@+id/textview_comment"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/post_image" …
Run Code Online (Sandbox Code Playgroud)

android android-elevation

6
推荐指数
1
解决办法
942
查看次数

标签 统计

android ×1

android-elevation ×1

appintents ×1

ios ×1

ios16 ×1