Android (Xamarin) 具体穿搭布局
Android (Xamarin) specific wear layout
我需要一个布局,它在 android 设置菜单中使用。
它看起来像左侧是图像,右侧是文本。当您向上或向下滚动时,屏幕上会显示 3 个项目。屏幕中间的图像和文字大于上方的文字和图像或下方。
更新
在方法 onCreateViewHolder
中步骤 "Create an Adapter to Populate the List" 的这个 link 示例中,我无法在应用程序启动时扩充布局 mInflater.inflate(R.layout.list_item, null)
我有一个异常:
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>
Layout比较简单,左边是图片,右边是TextView。您可以使用 WearableListView 来完成大部分工作;它扩展了 RecyclerView 并且那里有回调来通知您何时将行移动到中心或移出中心。在上面的示例中,我认为行之间的文本大小没有任何不同;偏心的有些褪色。您需要使用一个简单的动画师来放大图像和缩小尺寸并使用上述回调,当一个项目移动到中心时,将图像动画化并放大一个小因素,当它偏离中心时,动画化到原来的大小。 This training 是一个很好的起点。
我需要一个布局,它在 android 设置菜单中使用。
它看起来像左侧是图像,右侧是文本。当您向上或向下滚动时,屏幕上会显示 3 个项目。屏幕中间的图像和文字大于上方的文字和图像或下方。
更新
在方法 onCreateViewHolder
中步骤 "Create an Adapter to Populate the List" 的这个 link 示例中,我无法在应用程序启动时扩充布局 mInflater.inflate(R.layout.list_item, null)
我有一个异常:
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>
Layout比较简单,左边是图片,右边是TextView。您可以使用 WearableListView 来完成大部分工作;它扩展了 RecyclerView 并且那里有回调来通知您何时将行移动到中心或移出中心。在上面的示例中,我认为行之间的文本大小没有任何不同;偏心的有些褪色。您需要使用一个简单的动画师来放大图像和缩小尺寸并使用上述回调,当一个项目移动到中心时,将图像动画化并放大一个小因素,当它偏离中心时,动画化到原来的大小。 This training 是一个很好的起点。