Xamarin
에는 각 조각에 에 간단한 Bitmap
을 표시하는 일부 조각이있는 ViewPager
이 있습니다.ImageView 아래에 텍스트 표시
각 조각마다 이러한 이미지 아래에 텍스트를 추가해야합니다.
rootView = inflater.Inflate(Resource.Layout.ViewPagerItemWithImage, container, false);
imageView = rootView.FindViewById<ImageView>(Resource.Id.image);
DownloadAsyncBitmap (imageURI, imageView);
imageView.SetScaleType (ImageView.ScaleType.Center);
내가 위의 코드와 유사한 코드를 작성하는 데 도움이 있습니다 : 여기
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
는 관련 OnCreateView
코드 :
는 다음 각 조각에 대한 내 현재 ViewPagerItemWithImage
레이아웃 코드 대신 일부 텍스트는 ImageView
아래에 표시됩니까?
ViewPagerItemWithImageAndText
레이아웃 코드를 : 여기에
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/myImageViewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/image"
android:layout_alignTop="@+id/image"
android:layout_alignRight="@+id/image"
android:layout_alignBottom="@+id/image"
android:layout_margin="1dp"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:text="This is an image"
android:textColor="#000000" />
</LinearLayout>
OnCreateView
코드 :
rootView = inflater.Inflate(Resource.Layout.ViewPagerItemWithImageAndText, container, false);
imageView = rootView.FindViewById<ImageView>(Resource.Id.image);
textView = rootView.FindViewById<TextView>(Resource.Id.myImageViewText);
DownloadAsyncBitmap (imageURI, imageView);
텍스트가 전혀 표시되지 않습니다.
도와 드릴까요? 사전
고마워, 그 것이 잘 작동합니다. – user3736648