6
My app reads RSS feeds. but what bothers me is the letter that is small, I want to leave a little bigger that is visually "right" in a standard way. It’s like this:
But I want to make it bigger to better read the user. For example:
Code:
Detailfragment.java
package com.rs.player;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
import android.widget.ScrollView;
import android.widget.TextView;
import com.rs.player.parser.RSSFeed;
public class DetailFragment extends Fragment {
private int fPos;
RSSFeed fFeed;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
fFeed = (RSSFeed)getArguments().getSerializable("feed");
fPos = getArguments().getInt("pos");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.detail_fragment, container, false);
// Initializr views
TextView title = (TextView)view.findViewById(R.id.title);
WebView desc = (WebView)view.findViewById(R.id.desc);
// Enable the vertical fading edge (by default it is disabled)
// Set webview properties
WebSettings ws = desc.getSettings();
ws.setLightTouchEnabled(false);
ws.setPluginState(PluginState.ON);
ws.setJavaScriptEnabled(true);
ws.setLoadWithOverviewMode(true);
ws.setUseWideViewPort(true);
ws.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
ws.setBuiltInZoomControls(true);
ws.setUserAgentString("Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");
// Set the views
title.setText(fFeed.getItem(fPos).getTitle());
desc.loadDataWithBaseURL("http://www.androidcentral.com/", fFeed.getItem(fPos)
.getDescription(), "text/html", "UTF-8", null);
return view;
}
}
detail_fragment.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="@string/title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<WebView
android:id="@+id/desc"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/title"
android:scrollbarStyle="insideOverlay"
android:text="@string/desc" />
</RelativeLayout>
Already tried something like this: Websettings Settings = mWebView.getSettings(); Settings.setTextZoom(20);
– Marabita
did not help :/
– Kauan Kubaski
Try to force directly into html: String text = "<html><style type="text/css">p{text-align:Justify;font-size:80%;}</style></head><body>"+"<p>"+CONTENTS+"</p>"+"</body></html>"; mWebView.loadData(text, "text/html", "utf-8");
– Marabita
In your xml vc did not specify the size of the text, for example: android:textSize="18sp"
– ovoFrito