ViewListener example
zosocanuck opened this issue · 0 comments
zosocanuck commented
Hi,
I have the following custom view:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center">
<ImageView
android:id="@+id/fruitImageView"
android:layout_width="fill_parent"
android:layout_height="450dp"
android:scaleType="centerCrop" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/fruitImageView"
android:background="#bdbdbd">
<TextView
android:layout_width="wrap_content"
android:layout_height="44dp"
android:textAppearance="?android:attr/textAppearanceLarge"
style="@style/TextView.Label"
android:text="Large Text"
android:id="@+id/labelTextView"
android:layout_centerHorizontal="true"
android:textStyle="normal"
android:textColor="#000000"
android:layout_gravity="center_horizontal|bottom" />
</FrameLayout>
</RelativeLayout>
and set customCarouselView.setViewListener(viewListener);
ViewListener viewListener = new ViewListener() {
@OverRide
public View setViewForPosition(int position) {
View customView = getActivity().getLayoutInflater().inflate(R.layout.carousel_custom, null);
TextView labelTextView = (TextView) customView.findViewById(R.id.labelTextView);
ImageView fruitImageView = (ImageView) customView.findViewById(R.id.fruitImageView);
fruitImageView.setImageResource(sampleImages[position]);
labelTextView.setText(sampleTitles[position]);
customCarouselView.setIndicatorGravity(Gravity.CENTER_HORIZONTAL| Gravity.BOTTOM);
return customView;
}
};
however the image title is not displayed. Any ideas?