小编Cri*_*mez的帖子

如何集中回收者视图的项目?

我需要将每行中的元素居中,这样它们就像在这个模型中一样.我一直在寻找是否有任何布局以这种方式工作而不看.项目以行为中心.

小样

这就是我现在在代码中看起来的样子.在此输入图像描述

android android-layout android-recyclerview

46
推荐指数
5
解决办法
7万
查看次数

React native Touch事件正在通过绝对视图

我正在使用react-navigation,我有一个视图,我想在工具栏中按下图标时显示,我已经使用另一个组件并将组件设置为绝对显示,事实是,所有touchEvents都是通过叠加视图,我尝试在headerRightStyle上设置zIndex和elevation,即使在另一个子视图中也是绝对的视图.我也尝试使用TouchableWithoutFeedback作为包装,但也没有解决问题.

这是我的组成部分

import React, { Component } from 'react';
import {
  View,
  Text,
  UIManager,
  LayoutAnimation,
  Dimensions,
  TouchableWithoutFeedback,
} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';

const styles = {
  movieFilterListContainerStyle: {
    position: 'absolute',
    bottom: -300,
    right: -10,
    height: 300,
  },
};

class MovieFilter extends Component {
  constructor(props) {
    super(props);
    this.state = {
      showFilterList: false,
      filterListWidth: 0,
    };
    this.renderFilterList = this.renderFilterList.bind(this);
    this.onShowFilterList = this.onShowFilterList.bind(this);
    this.calculateFilterListWidth = this.calculateFilterListWidth.bind(this);
  }

  componentWillMount() {
    UIManager.setLayoutAnimationEnabledExperimental(true);
    this.calculateFilterListWidth();
    Dimensions.addEventListener('change', this.calculateFilterListWidth);
  }

  componentWillUpdate() {
    LayoutAnimation.spring();
  }

  componentWillUnmount() {
    Dimensions.removeEventListener('change', …
Run Code Online (Sandbox Code Playgroud)

android react-native react-navigation

11
推荐指数
1
解决办法
3276
查看次数