我有这个xml代码,我想适合一个图像全屏尺寸,我有这个代码,但我dint得到我所需要的。可以帮助我的任何人吗?我是新来的android,任何其他可能的方式来做到这一点?请帮我如何使图像适合屏幕?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:id="@+id/imageView" />
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v4.view.ViewPager>
class CustomPagerAdapter extends PagerAdapter {
Context mContext;
LayoutInflater mLayoutInflater;
int[] mResources = {
R.drawable.first,
R.drawable.second,
R.drawable.third,
R.drawable.fourth,
R.drawable.fifth,
R.drawable.sixth
};
我也曾尝试不同的scaleType方法,但它不起作用, – john
**你在哪里设置图片?你忘了'android:src =“@ drawable/your_picture”' –
使用'android:background =“@ drawable/pic”' – Kunu