【发布时间】:2018-09-11 08:11:36
【问题描述】:
我在图像视图中显示 Glide 图像时遇到问题。 我已经在这个很棒的网站上搜索了答案和其他网站,但没有达到目标!
1- 第一个问题:我想显示具有图像视图的全宽和全高的图像..
2- 第二个问题:如何制作全宽的可滚动图像视图...
请帮帮我!!我正在使用 GLIDE 库,并且我使用了许多其他库进行图像转换( BigImageView ..)
感谢您的帮助
这是 DisplayImg Activity 的代码
public class DisplayImg extends AppCompatActivity {
Context c ;
PhotoViewAttacher photoViewAttacher;
private AdView mAdView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_img);
ImageView imageView = findViewById(R.id.imageView);
GlideApp
.with(this).load(R.drawable.display)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(imageView);
photoViewAttacher=new PhotoViewAttacher(imageView);
// Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713
MobileAds.initialize(this, "ca-app-pub-3940256099942544~3347511713");
mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
// Making notification bar transparent
if (Build.VERSION.SDK_INT >= 21) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
changeStatusBarColor();
}
private void changeStatusBarColor() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
}
}
}
布局代码:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DisplayImg">
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:src="@drawable/display"
app:layout_constraintBottom_toTopOf="@+id/adView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111"
ads:layout_constraintBottom_toBottomOf="parent"
ads:layout_constraintEnd_toEndOf="parent"
ads:layout_constraintStart_toStartOf="parent"></com.google.android.gms.ads.AdView>
【问题讨论】:
-
贴出你到目前为止所做的代码
-
谢谢,请看代码
-
所以你的问题是如何使用屏幕的整个宽度和图像的可滚动高度?请也发布您的 xml。
-
是的..正是..请看代码
-
请立即检查代码!包括布局
标签: android android-layout android-studio android-glide