我正在试图在网页视图中加载GIF图像。它装载完美,但我想适合它在屏幕内。我的意思是,我不想滚动条(水平/垂直)。水平侧面安装,但在垂直侧不安装。请任何人都可以帮助我。安卓 - 网络视图不适合在屏幕上
活动
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Using Web view
setContentView(R.layout.activity_main);
WebView view = (WebView) findViewById(R.id.animationview);
// Only hide the scrollbar, not disables the scrolling:
view.setVerticalScrollBarEnabled(false);
view.setHorizontalScrollBarEnabled(false);
// Settings
WebSettings settings = view.getSettings();
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
settings.setSupportMultipleWindows(true);
// Load the GIF
String strUrl = "file:///android_asset/lk_animation.gif";
view.loadUrl(strUrl);
}
}
布局
< LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
< WebView
android:id="@+id/animationview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
嗨Naresh,你是怎么解决这个问题的?我面临着类似的问题。请帮帮我。 –