react-native - 如何在 React Native 中将视图相互叠加以实现与 Android 原生中的 FrameLayout 相同的效果
问题描述
我正在尝试将视图放在另一个之上,并使用本机 Android 开发,例如,我将使用框架布局来实现这一点
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#b1945c"
/>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ccd1cc"
android:layout_margin="50dp"
/>
</FrameLayout>
如何在 React Native 中实现相同的效果?
解决方案
试试这个,
<View style={{
flex:1,
backgroundColor:"#b1945c"
}}>
<View
style={{
margin:50,
backgroundColor:"#ccd1cc"
}}>
</View>
</View>
推荐阅读
- google-app-engine - Google App Engine 和 Google Cloud Run 有什么区别?
- git - 如何在 TortoiseGit 中找到未版本化的文件?
- reactjs - 扩展运算符未将值设置为正确状态
- google-sheets - 返回列中最后一次出现的字符串的索引
- python - 缩放 SVM 的超参数 C 有什么好处?
- python - 如何防止在 NLTK 中拆分特定的单词或短语和数字?
- android - Android 8 和 9 上不显示通知
- python - 如何根据日期时间列从数据框中提取子集?
- laravel-backpack - Laravel 背包演示为所有创建的页面安装 404 错误
- python-3.x - 是否有任何支持 open-GL 的卷积高级库?