- «android: elevation=» не работает на устройствах pre-Lollipop с компиляцией API21
- 3 ответов
- Android — elevation style property does not work without backgroundColor. #10411
- Comments
- niagr commented Oct 16, 2016
- Issue Description
- Steps to Reproduce / Code Snippets
- Expected Results
- Additional Information
- leeight commented Oct 20, 2016
- leeight commented Oct 20, 2016 •
- leeight commented Oct 21, 2016
- Kishanjvaghela commented Apr 28, 2017
- hramos commented Jul 20, 2017 •
«android: elevation=» не работает на устройствах pre-Lollipop с компиляцией API21
Я пытаюсь использовать «android: elevation =» в моем приложении, но после запуска он не появляется в устройстве с android 4.1.2
ш
макет.в XML
может быть, я неправильно компилирую Lollipop для устройств pre-lollipop, какие-либо предложения?
Если вам нужно увидеть другие части кода, я отредактирую вопрос
3 ответов
Высота требует, чтобы устройство запускало Lollipop. Увидеть этот ответ на как имитировать высоты https://stackoverflow.com/a/26747592/680249
обновлено ::
Лучшие Практики для этого
и добавить библиотеку для cardview
On Pre-Леденец вы можете использовать этот drawable
android: background= «@android: drawable / dialog_holo_light_frame»
это даст вам посмотреть высота
вы можете создать свой собственный такой
вы также можете использовать CardView из библиотеки поддержки для реализации поверхностей.
Для этого добавьте зависимость в свою сборку.Gradle в:
а затем просто используйте его в своих макетах:
здесь у вас есть гораздо больше возможностей настроить его по сравнению с используя @android:drawable/dialog_holo_light_frame фон
EDIT:
Также обратите внимание, что такой подход позволяет ты просто реализовать
Материальный Дизайн on Pre-Lolipop устройства.
Вы можете изменить высоту,
вокруг углов etc.
Для этого вы должны:
и не забудьте добавить xmlns:app=»http://schemas.android.com/apk/res-auto» к корневому макету.
также вы можете легко изменить высоту в коде:
использовать 8dp для подобрали и 2dp для отдыха (обычное) состояние, и вы будете потрясающе.
Источник
Android — elevation style property does not work without backgroundColor. #10411
Comments
niagr commented Oct 16, 2016
Issue Description
The elevation style property on Android does not work unless backgroundColor has been specified for the element.
With backgroundColor applied to instructions element:
Without backgroundColor applied:
Steps to Reproduce / Code Snippets
- Create a View
- Add elevation style property — notice it has no effect
- Add backgroundColor stype property — notice elevation is now applied
Expected Results
Unless I’m missing something elevation should get applied regardless of whether a view has a background color or not.
Additional Information
- React Native version: 0.33
- Platform(s) (iOS, Android, or both?): Android
- Operating System (macOS, Linux, or Windows?): Linux
The text was updated successfully, but these errors were encountered:
leeight commented Oct 20, 2016
leeight commented Oct 20, 2016 •
How about add a new style property such as outlineProvider (https://developer.android.com/reference/android/view/ViewOutlineProvider.html), just like what we did in Libraries/Components/View/ViewStylePropTypes.js
leeight commented Oct 21, 2016
Kishanjvaghela commented Apr 28, 2017
@niagr I have implemented CardView for react-native with elevation, that support android(All version) and iOS. Let me know is it help you or not. https://github.com/Kishanjvaghela/react-native-cardview
hramos commented Jul 20, 2017 •
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!
If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
- Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
- If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
- Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.
Источник