我有一个 a 的RecyclerView内部,ConstraintLayout其顶部从a的底部开始textView,其底部向下延伸到父级。我希望此中的项目RecyclerView默认为RecyclerView. 我尝试添加gravity="bottom"并且还尝试了与foregroundGravity和相同的事情layout_gravity。我还尝试添加layout_gravity="bottom"到我的recyclerView项目的布局。尽管如此, 中的所有项目recyclerView仍然默认为顶部。我能做些什么来确保物品在底部吗?这是xml:
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/my_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="needed to unlock next coupon"
android:textColor="@color/gray"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/irrelevant_tv"
android:layout_marginTop="@dimen/spacing_tiny"
android:gravity="center"
/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="@dimen/spacing_xl"
android:paddingTop="@dimen/spacing_large"
android:overScrollMode="always"
app:layoutManager="android.support.v7.widget.LinearLayoutManager"
app:layout_constraintTop_toBottomOf="@id/my_tv"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
我不想做wrap_content的recyclerView任何,因为否则就不是scrollable(我一直在这3项recyclerView,并根据用户的显示设置,recyclerView可以得到被推离屏幕,这需要我可以滚动)
android android-layout android-xml android-recyclerview android-constraintlayout
所以我正在开发一个项目,该项目使用来自https://github.com/lwansbrough/react-native-camera的react-native摄像机并让它正常工作.该组件将采用视频,数据将在Xcode的控制台中打印.不幸的是,我在计算机上丢失了这个文件和其他几个文件,并且从头开始重新启动应用程序.我一直试图重新创建具有视频录制功能的摄像机,但却无法使其正常工作.有人知道我做错了什么,因为我似乎无法弄明白.当我将captureMode更改为相机时,数据将打印出来,但视频不会发生任何事情.这是我的组件:
let startVideo = false;
class VideoCamera extends Component {
constructor() {
super()
this.state = {
captureMode: Camera.constants.CaptureMode.video,
}
}
render() {
return (
<Camera
captureMode={this.state.captureMode}
ref="camera"
style={styles.container}
>
<TouchableHighlight
onPressIn={this._startRecord.bind(this)}
onPressOut={this._endVideo.bind(this)}
>
<Icon
name={'video-camera'}
size={40}
style={styles.recordButton}
/>
</TouchableHighlight>
</Camera>
)
}
_startRecord() {
startVideo = setTimeout(this._recordVideo.bind(this), 50)
}
_recordVideo() {
this.refs.camera.capture({})
.then((data) => console.log(data))
.catch((err) => console.log(err))
}
_endVideo() {
this.refs.camera.stopCapture()
}
}
Run Code Online (Sandbox Code Playgroud) video video-capture reactjs react-native react-native-camera
我正在为AWS Lambda创建一个java函数,它从AWS S3引入一个文件,如下所示:
InputStream videoObjectStream = awsS3Video.getObjectContent();
我也在使用FFmpegFrameGrabber,这要求我在创建新的frameGrabber时指定文件路径,即: FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(filePath)
我试图将InputStream转换为我的Lambda函数中的临时文件,但它不允许我创建文件.这是我将代码转换videoObjectStream为文件的代码:
byte[] inputBuffer = null;
try {
inputBuffer = IOUtils.toByteArray(videoObjectStream);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
System.out.println("The length of the byte array is " + inputBuffer.length);
try {
FileOutputStream videoOS = new FileOutputStream(videoDetails.get("videoFileKey"), false);
videoOS.write(inputBuffer);
videoOS.close();
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
File tempVideoFile = new File(videoDetails.get("videoFileKey")); …Run Code Online (Sandbox Code Playgroud) 我正在使用React和Redux构建Web应用程序.当我在该页面上设置状态然后通过类似的语句重新访问它时,Redux工作this.props.book.bookTitle,但是,当我导航到另一个页面时,redux丢失它的状态并默认为initialState.这是我的代码:
bookDuck.js:
const BOOK_SELECT = "book/SELECT";
const BOOK_DESELECT = "book/DESELECT";
const initialState = {
_id: "",
bookTitle: "",
bookCover: "",
bookAuthors: [],
bookDescription: ""
};
export default function reducer(state = initialState, action) {
switch(action.type) {
case BOOK_SELECT:
return Object.assign({}, action.book);
case BOOK_DESELECT:
return initialState;
}
return state;
}
export function selectBook(book) {
console.log(book);
return {type: BOOK_SELECT, book};
}
export function deselectBook() {
return {type: BOOK_DESELECT};
}
Run Code Online (Sandbox Code Playgroud)
reducer.js:
import { combineReducers } from 'redux';
import user from './ducks/userDuck';
import …Run Code Online (Sandbox Code Playgroud) reactjs ×2
amazon-s3 ×1
android ×1
android-xml ×1
aws-lambda ×1
java ×1
javascript ×1
react-native ×1
react-redux ×1
redux ×1
video ×1