使用下面的代码,但是不能垂直滚动 WebView。可以水平滚动,垂直的不行。
public class OAuthentication extends Activity
{
private WebView myWebView = null;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.oauth_layout);
myWebView = (WebView) findViewById(R.id.webView);
myWebView.setVerticalScrollBarEnabled(true);
myWebView.setHorizontalScrollBarEnabled(true);
try {
String authUrl = String.format(Constants.OAUTH_URL,
Constants.API_KEY,
URLEncoder.encode("r_fullprofile rw_nus r_emailaddress r_network w_messages", "UTF-8"),
UUID.randomUUID().hashCode(),
Constants.REDIRECT_URI_OAUTH);
myWebView.setWebViewClient(new MyWebViewClient());
myWebView.loadUrl(authUrl);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
oauth_layout.xml
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_header"
/>
<WebView
android:id="@+id/webView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>