How can we display recyclerView in paragraph format












0















I am having a word file which contain some text I am getting that text in array list base on lines.



BufferedReader reader = null;

try {
reader = new BufferedReader(
new InputStreamReader(getAssets().open("surah1.txt"), "UTF-8"));
// do reading, usually loop until end of file reading

String mLine;

while ((mLine = reader.readLine())!= null ) {
surah1.add(mLine);
//process line
}

Log.i("TAG", "onCreateView: " + surah1);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null){
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}


When I am displaying it using RecyclerView it is either displaying in horizontal format or vertical format. But I want display it in paragraph format.



listView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL, true));

madapter = new testingAdapter(testing.this,surah1);
listView.setAdapter(madapter);


Actually what i want is when ever user click on the line i want to change that hole line color and also if user want to share he can share it. so thats the reason i am changing text file to array list. if any one is having any idea please help me out.



example:
In this image i am displaying that text by web view. but i want to display it base on lines so that when ever i click on line i can change that line color and share it.



i want it to be like this



but getting this when RecyclerView is in vertical format










share|improve this question

























  • Why not you use TextView?

    – Khemraj
    Jan 2 at 8:22
















0















I am having a word file which contain some text I am getting that text in array list base on lines.



BufferedReader reader = null;

try {
reader = new BufferedReader(
new InputStreamReader(getAssets().open("surah1.txt"), "UTF-8"));
// do reading, usually loop until end of file reading

String mLine;

while ((mLine = reader.readLine())!= null ) {
surah1.add(mLine);
//process line
}

Log.i("TAG", "onCreateView: " + surah1);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null){
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}


When I am displaying it using RecyclerView it is either displaying in horizontal format or vertical format. But I want display it in paragraph format.



listView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL, true));

madapter = new testingAdapter(testing.this,surah1);
listView.setAdapter(madapter);


Actually what i want is when ever user click on the line i want to change that hole line color and also if user want to share he can share it. so thats the reason i am changing text file to array list. if any one is having any idea please help me out.



example:
In this image i am displaying that text by web view. but i want to display it base on lines so that when ever i click on line i can change that line color and share it.



i want it to be like this



but getting this when RecyclerView is in vertical format










share|improve this question

























  • Why not you use TextView?

    – Khemraj
    Jan 2 at 8:22














0












0








0








I am having a word file which contain some text I am getting that text in array list base on lines.



BufferedReader reader = null;

try {
reader = new BufferedReader(
new InputStreamReader(getAssets().open("surah1.txt"), "UTF-8"));
// do reading, usually loop until end of file reading

String mLine;

while ((mLine = reader.readLine())!= null ) {
surah1.add(mLine);
//process line
}

Log.i("TAG", "onCreateView: " + surah1);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null){
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}


When I am displaying it using RecyclerView it is either displaying in horizontal format or vertical format. But I want display it in paragraph format.



listView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL, true));

madapter = new testingAdapter(testing.this,surah1);
listView.setAdapter(madapter);


Actually what i want is when ever user click on the line i want to change that hole line color and also if user want to share he can share it. so thats the reason i am changing text file to array list. if any one is having any idea please help me out.



example:
In this image i am displaying that text by web view. but i want to display it base on lines so that when ever i click on line i can change that line color and share it.



i want it to be like this



but getting this when RecyclerView is in vertical format










share|improve this question
















I am having a word file which contain some text I am getting that text in array list base on lines.



BufferedReader reader = null;

try {
reader = new BufferedReader(
new InputStreamReader(getAssets().open("surah1.txt"), "UTF-8"));
// do reading, usually loop until end of file reading

String mLine;

while ((mLine = reader.readLine())!= null ) {
surah1.add(mLine);
//process line
}

Log.i("TAG", "onCreateView: " + surah1);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null){
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}


When I am displaying it using RecyclerView it is either displaying in horizontal format or vertical format. But I want display it in paragraph format.



listView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL, true));

madapter = new testingAdapter(testing.this,surah1);
listView.setAdapter(madapter);


Actually what i want is when ever user click on the line i want to change that hole line color and also if user want to share he can share it. so thats the reason i am changing text file to array list. if any one is having any idea please help me out.



example:
In this image i am displaying that text by web view. but i want to display it base on lines so that when ever i click on line i can change that line color and share it.



i want it to be like this



but getting this when RecyclerView is in vertical format







android android-recyclerview






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 8:35









GianhTran

1,9701922




1,9701922










asked Jan 2 at 7:27









syed raheemsyed raheem

14




14













  • Why not you use TextView?

    – Khemraj
    Jan 2 at 8:22



















  • Why not you use TextView?

    – Khemraj
    Jan 2 at 8:22

















Why not you use TextView?

– Khemraj
Jan 2 at 8:22





Why not you use TextView?

– Khemraj
Jan 2 at 8:22












1 Answer
1






active

oldest

votes


















0














You just need to style your recyclerview item layout.
Try removing margin/padding from the item layout.






share|improve this answer
























  • but i want that item layout textview to be displayed side by side completely merged as u can see in first image

    – syed raheem
    Jan 2 at 7:33













  • I think this can't be achieved by RecyclerView. Try using flow layout so views is flowed side by side like this library: github.com/ApmeM/android-flowlayout

    – Mahmoud Elshamy
    Jan 2 at 7:36











  • ok thanks i will try that

    – syed raheem
    Jan 2 at 7:39











  • You can achieve it with ClicableSpan too. But I think it will be some complex. Take a look to this answer so you can add ClickableSpan to a single TextView: stackoverflow.com/a/34541570/2016500

    – Mahmoud Elshamy
    Jan 2 at 7:40











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002693%2fhow-can-we-display-recyclerview-in-paragraph-format%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You just need to style your recyclerview item layout.
Try removing margin/padding from the item layout.






share|improve this answer
























  • but i want that item layout textview to be displayed side by side completely merged as u can see in first image

    – syed raheem
    Jan 2 at 7:33













  • I think this can't be achieved by RecyclerView. Try using flow layout so views is flowed side by side like this library: github.com/ApmeM/android-flowlayout

    – Mahmoud Elshamy
    Jan 2 at 7:36











  • ok thanks i will try that

    – syed raheem
    Jan 2 at 7:39











  • You can achieve it with ClicableSpan too. But I think it will be some complex. Take a look to this answer so you can add ClickableSpan to a single TextView: stackoverflow.com/a/34541570/2016500

    – Mahmoud Elshamy
    Jan 2 at 7:40
















0














You just need to style your recyclerview item layout.
Try removing margin/padding from the item layout.






share|improve this answer
























  • but i want that item layout textview to be displayed side by side completely merged as u can see in first image

    – syed raheem
    Jan 2 at 7:33













  • I think this can't be achieved by RecyclerView. Try using flow layout so views is flowed side by side like this library: github.com/ApmeM/android-flowlayout

    – Mahmoud Elshamy
    Jan 2 at 7:36











  • ok thanks i will try that

    – syed raheem
    Jan 2 at 7:39











  • You can achieve it with ClicableSpan too. But I think it will be some complex. Take a look to this answer so you can add ClickableSpan to a single TextView: stackoverflow.com/a/34541570/2016500

    – Mahmoud Elshamy
    Jan 2 at 7:40














0












0








0







You just need to style your recyclerview item layout.
Try removing margin/padding from the item layout.






share|improve this answer













You just need to style your recyclerview item layout.
Try removing margin/padding from the item layout.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 2 at 7:31









Mahmoud ElshamyMahmoud Elshamy

1561212




1561212













  • but i want that item layout textview to be displayed side by side completely merged as u can see in first image

    – syed raheem
    Jan 2 at 7:33













  • I think this can't be achieved by RecyclerView. Try using flow layout so views is flowed side by side like this library: github.com/ApmeM/android-flowlayout

    – Mahmoud Elshamy
    Jan 2 at 7:36











  • ok thanks i will try that

    – syed raheem
    Jan 2 at 7:39











  • You can achieve it with ClicableSpan too. But I think it will be some complex. Take a look to this answer so you can add ClickableSpan to a single TextView: stackoverflow.com/a/34541570/2016500

    – Mahmoud Elshamy
    Jan 2 at 7:40



















  • but i want that item layout textview to be displayed side by side completely merged as u can see in first image

    – syed raheem
    Jan 2 at 7:33













  • I think this can't be achieved by RecyclerView. Try using flow layout so views is flowed side by side like this library: github.com/ApmeM/android-flowlayout

    – Mahmoud Elshamy
    Jan 2 at 7:36











  • ok thanks i will try that

    – syed raheem
    Jan 2 at 7:39











  • You can achieve it with ClicableSpan too. But I think it will be some complex. Take a look to this answer so you can add ClickableSpan to a single TextView: stackoverflow.com/a/34541570/2016500

    – Mahmoud Elshamy
    Jan 2 at 7:40

















but i want that item layout textview to be displayed side by side completely merged as u can see in first image

– syed raheem
Jan 2 at 7:33







but i want that item layout textview to be displayed side by side completely merged as u can see in first image

– syed raheem
Jan 2 at 7:33















I think this can't be achieved by RecyclerView. Try using flow layout so views is flowed side by side like this library: github.com/ApmeM/android-flowlayout

– Mahmoud Elshamy
Jan 2 at 7:36





I think this can't be achieved by RecyclerView. Try using flow layout so views is flowed side by side like this library: github.com/ApmeM/android-flowlayout

– Mahmoud Elshamy
Jan 2 at 7:36













ok thanks i will try that

– syed raheem
Jan 2 at 7:39





ok thanks i will try that

– syed raheem
Jan 2 at 7:39













You can achieve it with ClicableSpan too. But I think it will be some complex. Take a look to this answer so you can add ClickableSpan to a single TextView: stackoverflow.com/a/34541570/2016500

– Mahmoud Elshamy
Jan 2 at 7:40





You can achieve it with ClicableSpan too. But I think it will be some complex. Take a look to this answer so you can add ClickableSpan to a single TextView: stackoverflow.com/a/34541570/2016500

– Mahmoud Elshamy
Jan 2 at 7:40




















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54002693%2fhow-can-we-display-recyclerview-in-paragraph-format%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]