Recyclerview with both vertical and horizontal scrolling
Currently i'm making my apps layout for t.v, the issue i'm facing is i have a recyclerview to show recent activity of user, in mobiles i have shown the recent activity vertically, but in android t.v we have more width then height so i want to show recent activity horizontally i have tried many solution's like
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:orientation="horizontal" tools:layoutManager="android.support.v7.widget.LinearLayoutManager" />
but it's still displaying in vertical i dont know why..
I also tried adding the recyclerview in a ScrollView but still not working., maybe i'm declaring LinearLayoutManager in java that's why it's showing in vertical format..
Code of my fragment where i'm inflating the reclerview
View view=inflater.inflate(R.layout.recent_activity_tab1_recycler_view, container, false);
RecyclerView recent_activity_list = (RecyclerView) view.findViewById(R.id.recent_activity_list);
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity()));
android android-recyclerview
add a comment |
Currently i'm making my apps layout for t.v, the issue i'm facing is i have a recyclerview to show recent activity of user, in mobiles i have shown the recent activity vertically, but in android t.v we have more width then height so i want to show recent activity horizontally i have tried many solution's like
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:orientation="horizontal" tools:layoutManager="android.support.v7.widget.LinearLayoutManager" />
but it's still displaying in vertical i dont know why..
I also tried adding the recyclerview in a ScrollView but still not working., maybe i'm declaring LinearLayoutManager in java that's why it's showing in vertical format..
Code of my fragment where i'm inflating the reclerview
View view=inflater.inflate(R.layout.recent_activity_tab1_recycler_view, container, false);
RecyclerView recent_activity_list = (RecyclerView) view.findViewById(R.id.recent_activity_list);
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity()));
android android-recyclerview
add a comment |
Currently i'm making my apps layout for t.v, the issue i'm facing is i have a recyclerview to show recent activity of user, in mobiles i have shown the recent activity vertically, but in android t.v we have more width then height so i want to show recent activity horizontally i have tried many solution's like
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:orientation="horizontal" tools:layoutManager="android.support.v7.widget.LinearLayoutManager" />
but it's still displaying in vertical i dont know why..
I also tried adding the recyclerview in a ScrollView but still not working., maybe i'm declaring LinearLayoutManager in java that's why it's showing in vertical format..
Code of my fragment where i'm inflating the reclerview
View view=inflater.inflate(R.layout.recent_activity_tab1_recycler_view, container, false);
RecyclerView recent_activity_list = (RecyclerView) view.findViewById(R.id.recent_activity_list);
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity()));
android android-recyclerview
Currently i'm making my apps layout for t.v, the issue i'm facing is i have a recyclerview to show recent activity of user, in mobiles i have shown the recent activity vertically, but in android t.v we have more width then height so i want to show recent activity horizontally i have tried many solution's like
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:orientation="horizontal" tools:layoutManager="android.support.v7.widget.LinearLayoutManager" />
but it's still displaying in vertical i dont know why..
I also tried adding the recyclerview in a ScrollView but still not working., maybe i'm declaring LinearLayoutManager in java that's why it's showing in vertical format..
Code of my fragment where i'm inflating the reclerview
View view=inflater.inflate(R.layout.recent_activity_tab1_recycler_view, container, false);
RecyclerView recent_activity_list = (RecyclerView) view.findViewById(R.id.recent_activity_list);
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity()));
android android-recyclerview
android android-recyclerview
edited Nov 13 '18 at 8:56
Vadim Kotov
4,37953247
4,37953247
asked Nov 13 '18 at 8:50
shaheryarshaheryar
204
204
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
try to replace this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity()));
with this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
have tried this too, but it sets the orientation horizontal for mobiles too, i want it vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:02
so you have to check first if device is Tv or phone and then use one of the layout[horizontal - vertical] you may find this answer helpful for checking stackoverflow.com/questions/27138838/…
– Hazem Ashraf
Nov 13 '18 at 9:06
thanks it worked...
– shaheryar
Nov 13 '18 at 9:30
add a comment |
Don't give orientation there. Instead of that use layout manager for setting orientation of recyclerView.
For ex.
LinearLayoutManager layoutManager
= new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
Here first param is context, second is orientation and third is reverseLayout.
You can change orientation there.
but if i give orientation horizontal here then my mobile shows recyclerview in horizontal, i want it responsive vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:01
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%2f53277080%2frecyclerview-with-both-vertical-and-horizontal-scrolling%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
try to replace this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity()));
with this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
have tried this too, but it sets the orientation horizontal for mobiles too, i want it vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:02
so you have to check first if device is Tv or phone and then use one of the layout[horizontal - vertical] you may find this answer helpful for checking stackoverflow.com/questions/27138838/…
– Hazem Ashraf
Nov 13 '18 at 9:06
thanks it worked...
– shaheryar
Nov 13 '18 at 9:30
add a comment |
try to replace this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity()));
with this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
have tried this too, but it sets the orientation horizontal for mobiles too, i want it vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:02
so you have to check first if device is Tv or phone and then use one of the layout[horizontal - vertical] you may find this answer helpful for checking stackoverflow.com/questions/27138838/…
– Hazem Ashraf
Nov 13 '18 at 9:06
thanks it worked...
– shaheryar
Nov 13 '18 at 9:30
add a comment |
try to replace this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity()));
with this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
try to replace this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity()));
with this line
recent_activity_list.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
answered Nov 13 '18 at 8:56
Hazem AshrafHazem Ashraf
574
574
have tried this too, but it sets the orientation horizontal for mobiles too, i want it vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:02
so you have to check first if device is Tv or phone and then use one of the layout[horizontal - vertical] you may find this answer helpful for checking stackoverflow.com/questions/27138838/…
– Hazem Ashraf
Nov 13 '18 at 9:06
thanks it worked...
– shaheryar
Nov 13 '18 at 9:30
add a comment |
have tried this too, but it sets the orientation horizontal for mobiles too, i want it vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:02
so you have to check first if device is Tv or phone and then use one of the layout[horizontal - vertical] you may find this answer helpful for checking stackoverflow.com/questions/27138838/…
– Hazem Ashraf
Nov 13 '18 at 9:06
thanks it worked...
– shaheryar
Nov 13 '18 at 9:30
have tried this too, but it sets the orientation horizontal for mobiles too, i want it vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:02
have tried this too, but it sets the orientation horizontal for mobiles too, i want it vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:02
so you have to check first if device is Tv or phone and then use one of the layout[horizontal - vertical] you may find this answer helpful for checking stackoverflow.com/questions/27138838/…
– Hazem Ashraf
Nov 13 '18 at 9:06
so you have to check first if device is Tv or phone and then use one of the layout[horizontal - vertical] you may find this answer helpful for checking stackoverflow.com/questions/27138838/…
– Hazem Ashraf
Nov 13 '18 at 9:06
thanks it worked...
– shaheryar
Nov 13 '18 at 9:30
thanks it worked...
– shaheryar
Nov 13 '18 at 9:30
add a comment |
Don't give orientation there. Instead of that use layout manager for setting orientation of recyclerView.
For ex.
LinearLayoutManager layoutManager
= new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
Here first param is context, second is orientation and third is reverseLayout.
You can change orientation there.
but if i give orientation horizontal here then my mobile shows recyclerview in horizontal, i want it responsive vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:01
add a comment |
Don't give orientation there. Instead of that use layout manager for setting orientation of recyclerView.
For ex.
LinearLayoutManager layoutManager
= new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
Here first param is context, second is orientation and third is reverseLayout.
You can change orientation there.
but if i give orientation horizontal here then my mobile shows recyclerview in horizontal, i want it responsive vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:01
add a comment |
Don't give orientation there. Instead of that use layout manager for setting orientation of recyclerView.
For ex.
LinearLayoutManager layoutManager
= new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
Here first param is context, second is orientation and third is reverseLayout.
You can change orientation there.
Don't give orientation there. Instead of that use layout manager for setting orientation of recyclerView.
For ex.
LinearLayoutManager layoutManager
= new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
Here first param is context, second is orientation and third is reverseLayout.
You can change orientation there.
edited Nov 13 '18 at 8:56
Vadim Kotov
4,37953247
4,37953247
answered Nov 13 '18 at 8:54
The90sArtistThe90sArtist
417
417
but if i give orientation horizontal here then my mobile shows recyclerview in horizontal, i want it responsive vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:01
add a comment |
but if i give orientation horizontal here then my mobile shows recyclerview in horizontal, i want it responsive vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:01
but if i give orientation horizontal here then my mobile shows recyclerview in horizontal, i want it responsive vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:01
but if i give orientation horizontal here then my mobile shows recyclerview in horizontal, i want it responsive vertical for mobiles and horizontal for tv
– shaheryar
Nov 13 '18 at 9:01
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%2f53277080%2frecyclerview-with-both-vertical-and-horizontal-scrolling%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