相关疑难解决方法(0)

RecyclerView - 在特定位置获取视图

我有一个RecyclerView和一个活动ImageView.我正在使用它RecyclerView来水平显示图像列表.当我在点击图片RecyclerViewImageView在活动中应显示图像的大局观.到目前为止一切正常.

现在活动还有两个ImageButtons:imageButton_leftimageButton_right.当我点击时imageButton_left,该图像ImageView应向左转,并且该缩略图RecyclerView应反映此更改.情况类似imageButton_right.

我能够旋转ImageView.但是,我怎么能旋转缩略图RecyclerView?我如何获得ViewHolderImageView

码:

活动XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp" />


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/original_image"
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:scaleType="fitXY"
            android:src="@drawable/image_not_available_2" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:gravity="center_horizontal"
            android:orientation="horizontal">


            <ImageButton
                android:id="@+id/imageButton_left"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="20dp"
                android:background="@drawable/rotate_left_icon" />

            <ImageButton
                android:id="@+id/imageButton_right"
                android:layout_width="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

java android position widget android-recyclerview

123
推荐指数
9
解决办法
14万
查看次数

如何知道GridView何时完全绘制并准备就绪?

我有一个带有自定义适配器的长GridView,我怎么知道GridView何时完全显示并准备好了?

这是代码中的问题:

dashboard = (GridView) findViewById(R.id.dashboard);
dashboard.setAdapter(new ListItemsAdapter(this, allIcons));
AlertSomeItemsOfTheListView();
Run Code Online (Sandbox Code Playgroud)

在序列中,在完全绘制GridView之前执行方法"AlertSomeItemsOfTheListView".

android android-listview

8
推荐指数
1
解决办法
6528
查看次数