gpt4 book ai didi

Android (Xamarin) 特定的 wear layout

转载 作者:行者123 更新时间:2023-11-30 01:56:44 24 4
gpt4 key购买 nike

我需要一个布局,它在设置菜单中的 android wear 上使用。它看起来像左侧是图像,右侧是文本。当您向上或向下滚动时,屏幕上会显示 3 个项目。屏幕中间的图像和文字大于上方的文字和图像或下方。 enter image description here

更新

在此link在方法 onCreateViewHolder 中“创建适配器以填充列表”步骤中的示例 我无法在应用程序启动时膨胀布局 mInflater.inflate(R.layout.list_item, null)有一个异常(exception):

Binary XML file line #1: Error inflating class com.companyname.testcircleviewlayout.WearableListItemLayout

布局如下:

<?xml version="1.0" encoding="utf-8"?>
<com.companyname.testcircleviewlayout.WearableListItemLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="80dp">
<ImageView
android:id="@+id/circle"
android:layout_height="20dp"
android:layout_margin="16dp"
android:layout_width="20dp"
android:src="@drawable/wl_circle"/>
<TextView
android:id="@+id/name"
android:gravity="center_vertical|left"
android:layout_width="wrap_content"
android:layout_marginRight="16dp"
android:layout_height="match_parent"
android:lineSpacingExtra="-4sp"
android:textColor="@android:color/darker_gray"
android:textSize="16sp"/>
</com.companyname.testcircleviewlayout.WearableListItemLayout>

有人可以帮忙吗?

更新 2

需要添加到 androidManifest 下一行:

<activity>
<strong>
android:name=".CustomWearableList"
android:label="WearableList" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter></strong>
</activity>

最佳答案

布局很简单,左边是图片,右边是TextView。您可以使用 Wea​​rableListView 来完成大部分工作;它扩展了 RecyclerView 并且那里有回调来通知您何时将行移动到中心或移出中心。在上面的示例中,我认为行之间的文本大小没有任何不同;偏心的有些褪色。您需要使用一个简单的动画师来放大图像和缩小尺寸并使用上述回调,当一个项目移动到中心时,将图像动画化并放大一个小因素,当它偏离中心时,动画化到原来的大小。 This training是一个很好的起点。

关于Android (Xamarin) 特定的 wear layout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32093455/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com