我试图在我的观点下面留下一个阴影,从我在网上发现它应该很简单:
shadowOffset: { width: 10, height: 10 },
shadowColor: 'black',
shadowOpacity: 1.0,
Run Code Online (Sandbox Code Playgroud)
但问题是阴影根本没有出现.
这是我的组件
<View style={styles.shadow}>
<View style={styles.box} >
<View style={styles.ListComponent}>
<Text style={styles.itemText}>Livestream</Text>
</View>
</View>
</View>
Run Code Online (Sandbox Code Playgroud)
在我的StyleSheet中:
const styles = StyleSheet.create({
shadow: {
shadowOffset: { width: 10, height: 10 },
shadowColor: 'black',
shadowOpacity: 1.0
},
Run Code Online (Sandbox Code Playgroud)
有什么理由或有什么我错过了吗?
我正在遵循“简单 地拍照Android 开发人员指南”,除了将图片保存到图库之外,一切似乎都正常工作。
所有代码均取自指南,如下所示:
我有一个启动相机意图的浮动操作按钮
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dispatchTakePictureIntent();
}
});
private void dispatchTakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// Ensure that there's a camera activity to handle the intent
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
// Create the File where the photo should go
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException ex) {
// Error occurred while creating the File …
Run Code Online (Sandbox Code Playgroud) 我想知道是否可以调整图像大小以使其适合视图。
这就是我现在所拥有的
<View style={styles.container}>
<View style={styles.header}>
<Image
source={headerImage}
/>
</View>
<Text style={styles.basicText}>text</Text>
</View>
Run Code Online (Sandbox Code Playgroud)
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff"
},
header: {
height: 200,
backgroundColor: 'red'
},
background: {
width: null,
height: null
},
image: {
}
Run Code Online (Sandbox Code Playgroud)
我想让图像适合标题视图。