Issue
I want to design a XML resource layout like traditional blogs as shown in the below image. It should contain an image on the right side and rest of the area (combining left side area of the image and whole area below the image) should be filled with text.
Any ideas?
Solution
You are looking for FlowTextView
Here is an snippet
<uk.co.deanwild.flowtextview.FlowTextView
android:id="@+id/ftv"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="10dip"
android:src="@drawable/android"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="400dip"
android:padding="10dip"
android:src="@drawable/android2"/>
</uk.co.deanwild.flowtextview.FlowTextView>
and in code
FlowTextView flowTextView = (FlowTextView) findViewById(R.id.ftv);
Spanned html = Html.fromHtml("<html>Your html goes here....");
flowTextView.setText(html);
Add jitpack to your your build.gradle at the end of repositories:
repositories {
// ...
maven { url "https://jitpack.io" }
}
Add the dependency:
compile 'com.github.deano2390:FlowTextView:2.0.5'
Answered By - Khemraj Sharma


0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.