如何启用旋转图像自动加载和显示

时间:2015-02-10 10:03:12

标签: android image onitemclicklistener

我正在尝试启用旋转图像,以便在用户访问特定属性名称时自动加载和显示。

目前,我只能在用户在访问属性名称后点击图像缩略图时显示旋转图像。

如果用户没有点击图片缩略图,则用户只会看到圆形进度条。

因此,如何在用户访问属性名称而不选择缩略图图像后立即加载和显示图像?

代码

if (panoSize > 0) {
        g = (Gallery) findViewById(R.id.gallery01);
        g.setAdapter(new ImageAdapter());
        int pad = 15;
        g.setSpacing(1);
        g.setUnselectedAlpha(255);
        g.setPadding(pad, 10, pad, pad);
        g.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

                photo360Pb.setVisibility(View.VISIBLE);
                img_id = position+1;
                setImageShade(position);
                captionText.setText(caption[position]);

                Log.i("PropertyPanoramaActvity:if(panoSize>0)","******webView.loadUrl******"
                +getString(R.string.app_360_domain)+getString(R.string.app_360_property)
                +(getIntent().getIntExtra("propertyId", 0))+getString(R.string.app_360_directory)
                +(img_id)+getString(R.string.app_360_index));

                webView.loadUrl(String.format(getString(R.string.app_360_domain)
                        +getString(R.string.app_360_property)+(getIntent().getIntExtra("propertyId", 0))
                        +getString(R.string.app_360_directory)+img_id
                        +getString(R.string.app_360_index)));
            }
        });
    }

XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical" android:background="@color/transparent">
<include layout="@layout/header" />
<include layout="@layout/property_nav" />
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="10dp"
    android:background="@color/transparent">
    <include layout="@layout/property_share" />
</RelativeLayout>
<FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingRight="10dp"
    android:paddingLeft="10dp" android:layout_weight="4" android:orientation="vertical">
    <WebView android:id="@+id/webview01" android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:adjustViewBounds="true"></WebView>
    <ProgressBar android:id="@+id/photo360Pb" android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_gravity="center"  />
</FrameLayout>

<TextView
    android:id="@+id/caption"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:textColor="@color/white" />

<Gallery android:id="@+id/gallery01" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<include layout="@layout/mainmenu" />

0 个答案:

没有答案