How to use androidx.recyclerview.widget.RecyclerView with tools:listitem?
How to use androidx.recyclerview.widget.RecyclerView
with tools:listitem
?
I have this layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recyclerViewActors"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:listitem="@layout/list_item_actor"
tools:itemCount="5"
tools:orientation="horizontal"
tools:scrollbars="horizontal"
tools:spanCount="2"/>
but Design tab doesn't show preview:
And if I change androidx.recyclerview.widget.RecyclerView
in this layout to ListView
, the preview works:
android android-recyclerview preview androidx android-tools-namespace
add a comment |
How to use androidx.recyclerview.widget.RecyclerView
with tools:listitem
?
I have this layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recyclerViewActors"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:listitem="@layout/list_item_actor"
tools:itemCount="5"
tools:orientation="horizontal"
tools:scrollbars="horizontal"
tools:spanCount="2"/>
but Design tab doesn't show preview:
And if I change androidx.recyclerview.widget.RecyclerView
in this layout to ListView
, the preview works:
android android-recyclerview preview androidx android-tools-namespace
I copy past your code and is when I add this linetools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
in my code I have the same issue (don't see my items) so you can remove it if is not needed
– Crammeur
Aug 4 '18 at 15:59
@crammeur, but I have this issue and without this line
– Ksenia
Aug 4 '18 at 16:06
I see in the display of android studio thisjava.lang.ClassNotFoundException: androidx.recyclerview.widget.GridLayoutManager
can explain why you can't have the display. So he can't display because he not find this
– Crammeur
Aug 4 '18 at 16:11
Do you useimplementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
orimplementation 'androidx.recyclerview:recyclerview:1.0.0-alpha1'
because when I use alpha I can see but when I change I don't see preview
– Crammeur
Aug 4 '18 at 16:57
add a comment |
How to use androidx.recyclerview.widget.RecyclerView
with tools:listitem
?
I have this layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recyclerViewActors"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:listitem="@layout/list_item_actor"
tools:itemCount="5"
tools:orientation="horizontal"
tools:scrollbars="horizontal"
tools:spanCount="2"/>
but Design tab doesn't show preview:
And if I change androidx.recyclerview.widget.RecyclerView
in this layout to ListView
, the preview works:
android android-recyclerview preview androidx android-tools-namespace
How to use androidx.recyclerview.widget.RecyclerView
with tools:listitem
?
I have this layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recyclerViewActors"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:listitem="@layout/list_item_actor"
tools:itemCount="5"
tools:orientation="horizontal"
tools:scrollbars="horizontal"
tools:spanCount="2"/>
but Design tab doesn't show preview:
And if I change androidx.recyclerview.widget.RecyclerView
in this layout to ListView
, the preview works:
android android-recyclerview preview androidx android-tools-namespace
android android-recyclerview preview androidx android-tools-namespace
asked Aug 4 '18 at 15:43
KseniaKsenia
7461130
7461130
I copy past your code and is when I add this linetools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
in my code I have the same issue (don't see my items) so you can remove it if is not needed
– Crammeur
Aug 4 '18 at 15:59
@crammeur, but I have this issue and without this line
– Ksenia
Aug 4 '18 at 16:06
I see in the display of android studio thisjava.lang.ClassNotFoundException: androidx.recyclerview.widget.GridLayoutManager
can explain why you can't have the display. So he can't display because he not find this
– Crammeur
Aug 4 '18 at 16:11
Do you useimplementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
orimplementation 'androidx.recyclerview:recyclerview:1.0.0-alpha1'
because when I use alpha I can see but when I change I don't see preview
– Crammeur
Aug 4 '18 at 16:57
add a comment |
I copy past your code and is when I add this linetools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
in my code I have the same issue (don't see my items) so you can remove it if is not needed
– Crammeur
Aug 4 '18 at 15:59
@crammeur, but I have this issue and without this line
– Ksenia
Aug 4 '18 at 16:06
I see in the display of android studio thisjava.lang.ClassNotFoundException: androidx.recyclerview.widget.GridLayoutManager
can explain why you can't have the display. So he can't display because he not find this
– Crammeur
Aug 4 '18 at 16:11
Do you useimplementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
orimplementation 'androidx.recyclerview:recyclerview:1.0.0-alpha1'
because when I use alpha I can see but when I change I don't see preview
– Crammeur
Aug 4 '18 at 16:57
I copy past your code and is when I add this line
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
in my code I have the same issue (don't see my items) so you can remove it if is not needed– Crammeur
Aug 4 '18 at 15:59
I copy past your code and is when I add this line
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
in my code I have the same issue (don't see my items) so you can remove it if is not needed– Crammeur
Aug 4 '18 at 15:59
@crammeur, but I have this issue and without this line
– Ksenia
Aug 4 '18 at 16:06
@crammeur, but I have this issue and without this line
– Ksenia
Aug 4 '18 at 16:06
I see in the display of android studio this
java.lang.ClassNotFoundException: androidx.recyclerview.widget.GridLayoutManager
can explain why you can't have the display. So he can't display because he not find this– Crammeur
Aug 4 '18 at 16:11
I see in the display of android studio this
java.lang.ClassNotFoundException: androidx.recyclerview.widget.GridLayoutManager
can explain why you can't have the display. So he can't display because he not find this– Crammeur
Aug 4 '18 at 16:11
Do you use
implementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
or implementation 'androidx.recyclerview:recyclerview:1.0.0-alpha1'
because when I use alpha I can see but when I change I don't see preview– Crammeur
Aug 4 '18 at 16:57
Do you use
implementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
or implementation 'androidx.recyclerview:recyclerview:1.0.0-alpha1'
because when I use alpha I can see but when I change I don't see preview– Crammeur
Aug 4 '18 at 16:57
add a comment |
2 Answers
2
active
oldest
votes
From your code it seems that your recyclerview is the root element of the XML, and is missing the reference from xmlns:tools
Try to use another root element, as a constraint layout or even just layout as per example of google sunflowerapp:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/plant_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="@dimen/margin_normal"
android:paddingRight="@dimen/margin_normal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:context="com.google.samples.apps.sunflower.GardenActivity"
tools:listitem="@layout/list_item_plant" />
</layout>
add a comment |
Use
android.support.v7.widget.RecyclerView
android.support.v7.widget.GridLayoutManager
instead of
androidx.recyclerview.widget.RecyclerView
androidx.recyclerview.widget.GridLayoutManager
But I want to use namely androidx.recyclerview.widget.RecyclerView, why I can't to see preview for it?
– Ksenia
Aug 4 '18 at 16:07
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51687173%2fhow-to-use-androidx-recyclerview-widget-recyclerview-with-toolslistitem%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
From your code it seems that your recyclerview is the root element of the XML, and is missing the reference from xmlns:tools
Try to use another root element, as a constraint layout or even just layout as per example of google sunflowerapp:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/plant_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="@dimen/margin_normal"
android:paddingRight="@dimen/margin_normal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:context="com.google.samples.apps.sunflower.GardenActivity"
tools:listitem="@layout/list_item_plant" />
</layout>
add a comment |
From your code it seems that your recyclerview is the root element of the XML, and is missing the reference from xmlns:tools
Try to use another root element, as a constraint layout or even just layout as per example of google sunflowerapp:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/plant_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="@dimen/margin_normal"
android:paddingRight="@dimen/margin_normal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:context="com.google.samples.apps.sunflower.GardenActivity"
tools:listitem="@layout/list_item_plant" />
</layout>
add a comment |
From your code it seems that your recyclerview is the root element of the XML, and is missing the reference from xmlns:tools
Try to use another root element, as a constraint layout or even just layout as per example of google sunflowerapp:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/plant_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="@dimen/margin_normal"
android:paddingRight="@dimen/margin_normal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:context="com.google.samples.apps.sunflower.GardenActivity"
tools:listitem="@layout/list_item_plant" />
</layout>
From your code it seems that your recyclerview is the root element of the XML, and is missing the reference from xmlns:tools
Try to use another root element, as a constraint layout or even just layout as per example of google sunflowerapp:
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/plant_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingLeft="@dimen/margin_normal"
android:paddingRight="@dimen/margin_normal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:context="com.google.samples.apps.sunflower.GardenActivity"
tools:listitem="@layout/list_item_plant" />
</layout>
answered Jan 1 at 12:22
Tito RezendeTito Rezende
615
615
add a comment |
add a comment |
Use
android.support.v7.widget.RecyclerView
android.support.v7.widget.GridLayoutManager
instead of
androidx.recyclerview.widget.RecyclerView
androidx.recyclerview.widget.GridLayoutManager
But I want to use namely androidx.recyclerview.widget.RecyclerView, why I can't to see preview for it?
– Ksenia
Aug 4 '18 at 16:07
add a comment |
Use
android.support.v7.widget.RecyclerView
android.support.v7.widget.GridLayoutManager
instead of
androidx.recyclerview.widget.RecyclerView
androidx.recyclerview.widget.GridLayoutManager
But I want to use namely androidx.recyclerview.widget.RecyclerView, why I can't to see preview for it?
– Ksenia
Aug 4 '18 at 16:07
add a comment |
Use
android.support.v7.widget.RecyclerView
android.support.v7.widget.GridLayoutManager
instead of
androidx.recyclerview.widget.RecyclerView
androidx.recyclerview.widget.GridLayoutManager
Use
android.support.v7.widget.RecyclerView
android.support.v7.widget.GridLayoutManager
instead of
androidx.recyclerview.widget.RecyclerView
androidx.recyclerview.widget.GridLayoutManager
answered Aug 4 '18 at 16:02
Viswanath Kumar SanduViswanath Kumar Sandu
1,1431715
1,1431715
But I want to use namely androidx.recyclerview.widget.RecyclerView, why I can't to see preview for it?
– Ksenia
Aug 4 '18 at 16:07
add a comment |
But I want to use namely androidx.recyclerview.widget.RecyclerView, why I can't to see preview for it?
– Ksenia
Aug 4 '18 at 16:07
But I want to use namely androidx.recyclerview.widget.RecyclerView, why I can't to see preview for it?
– Ksenia
Aug 4 '18 at 16:07
But I want to use namely androidx.recyclerview.widget.RecyclerView, why I can't to see preview for it?
– Ksenia
Aug 4 '18 at 16:07
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51687173%2fhow-to-use-androidx-recyclerview-widget-recyclerview-with-toolslistitem%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I copy past your code and is when I add this line
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
in my code I have the same issue (don't see my items) so you can remove it if is not needed– Crammeur
Aug 4 '18 at 15:59
@crammeur, but I have this issue and without this line
– Ksenia
Aug 4 '18 at 16:06
I see in the display of android studio this
java.lang.ClassNotFoundException: androidx.recyclerview.widget.GridLayoutManager
can explain why you can't have the display. So he can't display because he not find this– Crammeur
Aug 4 '18 at 16:11
Do you use
implementation 'androidx.recyclerview:recyclerview:1.0.0-beta01'
orimplementation 'androidx.recyclerview:recyclerview:1.0.0-alpha1'
because when I use alpha I can see but when I change I don't see preview– Crammeur
Aug 4 '18 at 16:57