自动图片切换 Gallery

来源:互联网 发布:jquery.tips.js 用法 编辑:程序博客网 时间:2024/04/27 16:43
package com.ejoy.customcontrol;import java.util.TimerTask;import com.ejoy.android.FrmHomeFoodActivity;import android.content.Context;import android.util.AttributeSet;import android.view.KeyEvent;import android.view.MotionEvent;import android.widget.Gallery;public class HomeFoodGuideGallery extends Gallery {private FrmHomeFoodActivity m_iact;public HomeFoodGuideGallery(Context context) {super(context);}public HomeFoodGuideGallery(Context context, AttributeSet attrs) {super(context, attrs);}public HomeFoodGuideGallery(Context context, AttributeSet attrs,int defStyle) {super(context, attrs, defStyle);}public FrmHomeFoodActivity getM_iact() {return m_iact;}public void setFrmHomeFoodActivity(FrmHomeFoodActivity m_iact) {this.m_iact = m_iact;}@Overridepublic boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) {new java.util.Timer().schedule(new TimerTask() {@Overridepublic void run() {m_iact.timeFlag = false;this.cancel();}}, 5000);int kEvent;if (isScrollingLeft(e1, e2)) { // Check if scrolling leftkEvent = KeyEvent.KEYCODE_DPAD_LEFT;} else { // Otherwise scrolling rightkEvent = KeyEvent.KEYCODE_DPAD_RIGHT;}onKeyDown(kEvent, null);if (this.getSelectedItemPosition() == 0)this.setSelection(m_iact.urls.size());return true;}private boolean isScrollingLeft(MotionEvent e1, MotionEvent e2) {return e2.getX() > e1.getX();}@Overridepublic boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,float distanceY) {m_iact.timeTaks.timeCondition = false;return super.onScroll(e1, e2, distanceX, distanceY);}}

package com.ejoy.android;

import java.util.ArrayList;import java.util.HashMap;import java.util.Timer;import java.util.TimerTask;

import com.ejoy.customcontrol.CustomProgressDialog;import com.ejoy.customcontrol.HomeFoodGuideGallery;import com.ejoy.customcontrol.LinearLayoutForListView;import com.ejoy.dal.DALAdCategoryHelper;import com.ejoy.dal.DALAdvertisingHelper;import com.ejoy.dal.DALArticleHelper;import com.ejoy.model.Article;import com.ejoy.model.BaseAdvertising;import com.ejoy.utils.Adtype;import com.ejoy.utils.ArticleCategory;import com.ejoy.utils.MessageBox;import com.ejoy.utils.StringUtils;import com.ejoy.adpter.*;import com.ejoy.adpter.AsyncBitmapLoader.ImageCallBack;

import android.content.Intent;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.os.AsyncTask;import android.os.Bundle;import android.os.Handler;import android.os.Message;import android.util.Log;import android.view.View;import android.view.View.OnClickListener;import android.widget.AdapterView;import android.widget.ImageView;import android.widget.LinearLayout;import android.widget.AdapterView.OnItemClickListener;

public class FrmHomeFoodActivity extends BaseActivity {

 private final String TAG = this.getClass().getSimpleName().toString(); public HashMap<String, Bitmap> imagesCache = new HashMap<String, Bitmap>(); public ArrayList<String> urls = new ArrayList<String>(); public HomeFoodGuideGallery images_ga; private int positon = 0; private Thread timeThread = null; public boolean timeFlag = true; private boolean isExit = false; public ImageTimerTask timeTaks = null; Timer autoGallery = new Timer();

 private DALArticleHelper maArticleHelper = null; private DALAdvertisingHelper dalAdvertising = null; private DALAdCategoryHelper dalAdCategory = null; private final String listViewItemString = "bussname"; private final String ListViewItemID = "id"; private final String ListViewItemUrl = "url"; private CustomProgressDialog progressDialog = null;

 private boolean isNewsLoading = false;

 LinearLayoutForListView lvListView; private final int STATE_FINISH = 1; private ImageView ivAdImageViewSmall1 = null; private ImageView ivAdImageViewSmall2 = null; private ImageView ivAdImageViewSmall3 = null; private ImageView ivAdImageViewSmall4 = null; AdapterForLinearLayout Layoutadpater = null; AsyncBitmapLoader asyncBitmapLoader = new AsyncBitmapLoader(); private ImageDownloader mImageDownloader = null; private ArrayList<HashMap<String, Object>> oldEjoyNewsArrayList = new ArrayList<HashMap<String, Object>>(); private ArrayList<BaseAdvertising> smallList = new ArrayList<BaseAdvertising>(); private ArrayList<BaseAdvertising> flashList = new ArrayList<BaseAdvertising>();

 @Override protected void onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  this.setContentView(R.layout.frmhomefoodactivity);  ((CrashApplication) this.getApplication())    .addActivity(FrmHomeFoodActivity.this);  maArticleHelper = new DALArticleHelper(FrmHomeFoodActivity.this);  mImageDownloader = new ImageDownloader(FrmHomeFoodActivity.this);  dalAdvertising = new DALAdvertisingHelper(FrmHomeFoodActivity.this);  dalAdCategory = new DALAdCategoryHelper(FrmHomeFoodActivity.this);  findviewbyid();  SetControlEvents();  oldEjoyNewsArrayList = getData();

  /**   * 乐讯的单击事件   */  lvListView.setOnclickLinstener(new View.OnClickListener() {   public void onClick(View v) {    String urlString = Layoutadpater.get(      Integer.parseInt(v.getTag().toString()),      ListViewItemUrl);    String TitleString = Layoutadpater.get(      Integer.parseInt(v.getTag().toString()),      listViewItemString);    // String idString = Layoutadpater.get(    // Integer.parseInt(v.getTag().toString()), ListViewItemID);    Intent mIntent = new Intent(FrmHomeFoodActivity.this,      FrmEjoylinkNewsActivity.class);    mIntent.putExtra("title", TitleString);    mIntent.putExtra("url", urlString);    // mIntent.putExtra("idString", idString);    startActivity(mIntent);   }  }); /* timeTaks = new ImageTimerTask();  autoGallery.scheduleAtFixedRate(timeTaks, 5000, 5000);  timeThread = new Thread() {   @Override   public void run() {    while (!isExit) {     try {      Thread.sleep(1500);     } catch (InterruptedException e) {      // e.printStackTrace();     }     synchronized (timeTaks) {      if (!timeFlag) {       timeTaks.timeCondition = true;       Log.e("timeTaks", "timeTaks.notifyAll");       timeTaks.notifyAll();      }     }     timeFlag = true;    }   };  };  timeThread.start();  */  if (!isNewsLoading) {   String string = "";   new LoadingJoyLinkNewsAsyncTask().execute(string);  } }

 void findviewbyid() {  lvListView = (LinearLayoutForListView) findViewById(R.id.linearLayoutForListView2);

  ivAdImageViewSmall1 = (ImageView) findViewById(R.id.homefood_ivad3small);  ivAdImageViewSmall2 = (ImageView) findViewById(R.id.homefood_ivad4small);  ivAdImageViewSmall3 = (ImageView) findViewById(R.id.homefood_ivad5small);  ivAdImageViewSmall4 = (ImageView) findViewById(R.id.homefood_ivad6small);  images_ga = (HomeFoodGuideGallery) findViewById(R.id.homefood_image_wall_gallery); }

 void SetControlEvents() {  ivAdImageViewSmall1.setOnClickListener(new ImageViewAdClickListenr());  ivAdImageViewSmall2.setOnClickListener(new ImageViewAdClickListenr());  ivAdImageViewSmall3.setOnClickListener(new ImageViewAdClickListenr());  ivAdImageViewSmall4.setOnClickListener(new ImageViewAdClickListenr()); }

 private ArrayList<HashMap<String, Object>> getData() {  ArrayList<HashMap<String, Object>> arrayList = new ArrayList<HashMap<String, Object>>();  ArrayList<Article> aList = new ArrayList<Article>();  try {   // 底部的乐讯   aList = maArticleHelper     .GetArticleJsonLocal(ArticleCategory.ArticleCategoryFood);   for (Article baseArticle : aList) {    HashMap<String, Object> map = new HashMap<String, Object>();    map.put(ListViewItemID, baseArticle.getId());    map.put(listViewItemString, baseArticle.getTitle());    map.put(ListViewItemUrl, baseArticle.getUrl());    arrayList.add(map);   }   flashList = dalAdvertising     .GetSimpleAdvertisingCursor(Adtype.FoodFlash);   if (flashList.size() > 0) {    urls.clear();    for (BaseAdvertising madvertising : flashList) {     String string = madvertising.getAdImagePath().toString();     if (!urls.contains(string)) {      urls.add(string);     }    }   }   smallList = dalAdvertising     .GetSimpleAdvertisingCursor(Adtype.FoodSmall);  } catch (Exception e) {   FrmHomeFoodActivity.this.error(TAG, e);  }  // 返回乐讯  return arrayList; }

 private void startProgressDialog() {  if (progressDialog == null) {   progressDialog = CustomProgressDialog     .createDialog(FrmHomeFoodActivity.this.getParent());   progressDialog.setMessage("正在加载中...");  }  progressDialog.show(); }

 private void stopProgressDialog() {  if (progressDialog != null) {   progressDialog.dismiss();   progressDialog = null;  } }

 /***  * 每5秒执行一次  * @author Administrator  *  */ public class ImageTimerTask extends TimerTask {  public volatile boolean timeCondition = true;  int gallerypisition = 0;

  @Override  public void run() {   synchronized (this) {    while (!timeCondition) {     try {      Thread.sleep(500);      wait();     } catch (InterruptedException e) {      Thread.interrupted();     }    }   }   try {    gallerypisition = images_ga.getSelectedItemPosition() + 1;    if (gallerypisition >= images_ga.getCount()) {     gallerypisition = 0;    }    Message msg = new Message();    Bundle date = new Bundle();// 瀛樻斁鏁版嵁    date.putInt("pos", gallerypisition);    msg.setData(date);    msg.what = 1;// 娑堟伅鏍囪瘑    autoGalleryHandler.sendMessage(msg);   } catch (Exception e) {    FrmHomeFoodActivity.this.error(TAG, e);   }  } }

 final Handler autoGalleryHandler = new Handler() {  @Override  public void handleMessage(Message message) {   super.handleMessage(message);   switch (message.what) {   case 1:    Log.e("autoGalleryHandler",      "autoGalleryHandler.handleMessage=1.setSelection");    //changePointView(message.getData().getInt("pos"));    images_ga.setSelection(message.getData().getInt("pos"));    break;   }  } };

 /**  * 更改底层的红点与白点  * @param cur  */ public void changePointView(int cur) {   Log.e("changePointView", "changePointView.poisition=" + positon);   Log.e("changePointView", "cur="+cur);   //初始值或者不相等的情况下执行   LinearLayout pointLinear = (LinearLayout) findViewById(R.id.homefood_gallery_point_linear);   View view = pointLinear.getChildAt(positon);   View curView = pointLinear.getChildAt(cur);   if (view != null && curView != null) {    ImageView pointView = (ImageView) view;    ImageView curPointView = (ImageView) curView;    pointView.setBackgroundResource(R.drawable.feature_point);    curPointView      .setBackgroundResource(R.drawable.feature_point_cur);    positon = cur;   }   }

 @Override protected void onResume() {  super.onResume();  timeFlag = false; }

 @Override protected void onPause() {  super.onPause();  timeTaks.timeCondition = false; }

 @Override protected void onStart() {  super.onStart();

 }

 @Override protected void onDestroy() {  stopProgressDialog();  if (maArticleHelper != null) {   maArticleHelper.CloseDb();  }  if (dalAdCategory != null) {   dalAdCategory.CloseDb();  }  super.onDestroy(); }

 private void init() {  Log.e("init", "init");  Bitmap image = BitmapFactory.decodeResource(getResources(),    R.drawable.defaultbj);  imagesCache.put("background_non_load", image);  images_ga.setFrmHomeFoodActivity(this);  ImageAdapter imageAdapter = new ImageAdapter(urls, this,    R.layout.frmhomefoodactivity);  images_ga.setAdapter(imageAdapter);  LinearLayout pointLinear = (LinearLayout) findViewById(R.id.homefood_gallery_point_linear);  for (int i = 0; i < urls.size(); i++) {   ImageView pointView = new ImageView(this);   if (i == 0) {    pointView.setBackgroundResource(R.drawable.feature_point_cur);   } else    pointView.setBackgroundResource(R.drawable.feature_point);   pointLinear.addView(pointView);  }  images_ga.setOnItemClickListener(new OnItemClickListener() {   public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,     long arg3) {    BaseAdvertising mAdvertising = flashList.get(arg2);    Intent mIntent = new Intent(FrmHomeFoodActivity.this,      FrmEjoylinkNewsActivity.class);    mIntent.putExtra("title", mAdvertising.getTitleString());    mIntent.putExtra("url", mAdvertising.getLinkString());    startActivity(mIntent);   }  }); }

 /**  * 异步加载乐讯的方法  */ private class LoadingJoyLinkNewsAsyncTask extends   AsyncTask<String, Integer, Integer> {  private boolean iserror = false;  ArrayList<HashMap<String, Object>> sList = new ArrayList<HashMap<String, Object>>();

  ArrayList<BaseAdvertising> blist = new ArrayList<BaseAdvertising>();  ArrayList<BaseAdvertising> clist = new ArrayList<BaseAdvertising>();

  @Override  protected final void onPreExecute() {   startProgressDialog();   super.onPreExecute();  }

  @Override  protected void onCancelled() {

   stopProgressDialog();   super.onCancelled();  }

  @Override  protected Integer doInBackground(String... params) {   // 底部的乐讯   ArrayList<Article> aList = null;   try {    aList = maArticleHelper      .GetArticleJsonString(ArticleCategory.ArticleCategoryFood);    for (Article baseArticle : aList) {     HashMap<String, Object> map = new HashMap<String, Object>();     map.put(ListViewItemID, baseArticle.getId());     map.put(listViewItemString, baseArticle.getTitle());     map.put(ListViewItemUrl, baseArticle.getUrl());     sList.add(map);    }   } catch (org.apache.http.conn.HttpHostConnectException e) {    FrmHomeFoodActivity.this.error(TAG, e);   } catch (Exception e) {    iserror = true;    FrmHomeFoodActivity.this.error(TAG, e);   }   // -广告的加载   try {    blist = dalAdvertising.getAdjsonString(Adtype.FoodFlash);

   } catch (org.apache.http.conn.HttpHostConnectException e) {    FrmHomeFoodActivity.this.error(TAG, e);   } catch (Exception e) {    iserror = true;    FrmHomeFoodActivity.this.error(TAG, e);   }   // 小图   try {    clist = dalAdvertising.getAdjsonString(Adtype.FoodSmall);   } catch (org.apache.http.conn.HttpHostConnectException e) {    FrmHomeFoodActivity.this.error(TAG, e);   } catch (Exception e) {    iserror = true;    FrmHomeFoodActivity.this.error(TAG, e);   }   return STATE_FINISH;  }

  @Override  protected void onPostExecute(Integer result) {   stopProgressDialog();   int state = result.intValue();   switch (state) {   case STATE_FINISH:    if (blist.size() > 0) {     flashList = blist;    }    urls.clear();    for (BaseAdvertising baseAdvertising : flashList) {     String string = baseAdvertising.getAdImagePath();     if (!urls.contains(string)) {      urls.add(string);     }    }    // 小图    if (clist.size() > 0) {     smallList = clist;    }    int k = 0;    ImageView iView = null;    for (BaseAdvertising mBaseAdvertising : smallList) {     if (k < 4) {      if (k == 0) {       iView = ivAdImageViewSmall1;      } else if (k == 1) {       iView = ivAdImageViewSmall2;      } else if (k == 2) {       iView = ivAdImageViewSmall3;      } else if (k == 3) {       iView = ivAdImageViewSmall4;      }     } else {      iView = null;     }     if (iView != null) {      mImageDownloader.download(        mBaseAdvertising.getAdImagePath(), iView);      iView.setTag(mBaseAdvertising.getLinksId());     }     k++;    }    if (iserror) {     MessageBox.ShowMakeText(FrmHomeFoodActivity.this, "信息加载失败");    }    iserror = false;    isNewsLoading = true;    if (sList.size() > 0) {     oldEjoyNewsArrayList = sList;    }    Layoutadpater = new AdapterForLinearLayout(      FrmHomeFoodActivity.this, oldEjoyNewsArrayList,      R.layout.frmfoodtest,      new String[] { listViewItemString },      new int[] { R.id.TextView0002 });    lvListView.setAdapter(Layoutadpater);           timeTaks = new ImageTimerTask();    autoGallery.scheduleAtFixedRate(timeTaks, 5000, 5000);    timeThread = new Thread() {     @Override     public void run() {      while (!isExit) {       try {        Thread.sleep(1500);       } catch (InterruptedException e) {        // e.printStackTrace();       }       synchronized (timeTaks) {        if (!timeFlag) {         timeTaks.timeCondition = true;         Log.e("timeTaks", "timeTaks.notifyAll");         timeTaks.notifyAll();        }       }       timeFlag = true;      }     };    };    timeThread.start();    init();    break;   default:    break;   }  } }

 /***  *   * @author Administrator  *   */ private class ImageViewAdClickListenr implements OnClickListener {  public void onClick(View v) {   ImageView oiView = (ImageView) v;   if (oiView.getTag() != null     && !StringUtils.IsEmptyOrNull(oiView.getTag().toString())) {    Intent mIntent = new Intent(FrmHomeFoodActivity.this,      FrmCouponDetailsActivity.class);    mIntent.putExtra("couponid",      String.valueOf(oiView.getTag().toString()));    startActivity(mIntent);   }  } }}

package com.ejoy.adpter;
import java.io.File;import java.io.InputStream;import java.net.URL;import java.net.URLConnection;import java.util.List;
import com.ejoy.android.FrmHomeFoodActivity;import com.ejoy.android.FrmHomeLivingActivity;import com.ejoy.android.FrmHomeRecreationActivity;import com.ejoy.android.FrmHomeShoppingActivity;import com.ejoy.android.R;import com.ejoy.common.BaseCommon;
import android.content.Context;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.os.AsyncTask;import android.os.Handler;import android.os.Message;import android.util.Log;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.view.ViewGroup.LayoutParams;import android.widget.BaseAdapter;import android.widget.Gallery;import android.widget.ImageView;
public class ImageAdapter extends BaseAdapter { private List<String> imageUrls; // 图片地址list private Context context; private ImageAdapter self; private int activityid = -1;
 private ImageDownloader mImageDownloader = null;
 protected String GetDatabasePath(String name) {  String EXTERN_PATH = null;  if (com.ejoy.FileServer.SDCardOperation.CanSdCardUse()) {   EXTERN_PATH = android.os.Environment.getExternalStorageDirectory()     .getAbsolutePath() + BaseCommon.FileCachePath;   File f = new File(EXTERN_PATH);   if (!f.exists()) {    f.mkdirs();   }  }  if (name.trim() == "") {   return EXTERN_PATH;  } else {   return EXTERN_PATH + name;  } }
 public ImageAdapter(List<String> imageUrls, Context context, int activityid) {  mImageDownloader = new ImageDownloader(context);  this.imageUrls = imageUrls;  this.context = context;  this.self = this;  this.activityid = activityid; }
 public int getCount() {  return imageUrls.size(); }
 public Object getItem(int position) {  return imageUrls.get(position % imageUrls.size()); }
 public long getItemId(int position) {  return position; }
 public View getView(int position, View convertView, ViewGroup parent) {  Log.e("adapter", "getView()");  // Bitmap image = null;  ImageView imageView = null;  if (convertView == null) {   // 实例化convertView   convertView = LayoutInflater.from(context).inflate(     R.layout.hoemgalleryitemlayout, null);   Gallery.LayoutParams params = new Gallery.LayoutParams(     LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);   convertView.setLayoutParams(params);   /*    * if (image == null) { image =    * BitmapFactory.decodeResource(context.    * getResources(),R.drawable.defaultejoycoupon); // LoadImageTask    * task = new LoadImageTask(convertView);    * //task.execute(imageUrls.get(position % imageUrls.size())); }    */
   imageView = (ImageView) convertView     .findViewById(R.id.gallery_image);   convertView.setTag(imageView);  } else {   imageView = (ImageView) convertView.getTag();  }  // imageView.setImageBitmap(image);  imageView.setScaleType(ImageView.ScaleType.FIT_XY);  int k = 0;  if (imageUrls.size() != 0) {   k = position % imageUrls.size();  }  switch (activityid) {  case R.layout.frmhomefoodactivity:   ((FrmHomeFoodActivity) context).changePointView(k);   break;  case R.layout.frmhomelivingactivity:   ((FrmHomeLivingActivity) context).changePointView(k);   break;  case R.layout.frmhomerecreationactivity:   ((FrmHomeRecreationActivity) context).changePointView(k);   break;  case R.layout.frmhomeshoppingactivity:   ((FrmHomeShoppingActivity) context).changePointView(k);   break;  }  mImageDownloader.download(imageUrls.get(position % imageUrls.size()),    imageView);  return convertView; }
 /***  *   * @author Administrator  *   */ class LoadImageTask extends AsyncTask<String, Void, Bitmap> {  private View resultView;
  LoadImageTask(View resultView) {   this.resultView = resultView;  }
  @Override  protected void onPostExecute(Bitmap bitmap) {   resultView.setTag(bitmap);  }
  @Override  protected Bitmap doInBackground(String... params) {   Bitmap image = null;   try {    URL url = new URL(params[0]);    URLConnection conn = url.openConnection();    conn.connect();    InputStream is = conn.getInputStream();    image = BitmapFactory.decodeStream(is);    is.close();    Message m = new Message();    m.what = 0;    mHandler.sendMessage(m);   } catch (Exception e) {    e.printStackTrace();   }   return image;  } }
 private Handler mHandler = new Handler() {  @Override  public void handleMessage(Message msg) {   try {    switch (msg.what) {    case 0:     Log.e("adapter", "notifyDataSetChanged()");     self.notifyDataSetChanged();     break;    }    super.handleMessage(msg);   } catch (Exception e) {   }  } };}
<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android"    android:id="@+id/scrollView1"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:background="@color/white"    android:scrollbars="none" >    <LinearLayout        android:layout_width="match_parent"        android:layout_height="460dp"        android:background="@color/white"        android:gravity="top|center"        android:orientation="vertical" >        <RelativeLayout            android:layout_width="fill_parent"            android:layout_height="130dp" >            <com.ejoy.customcontrol.HomeFoodGuideGallery                android:id="@+id/homefood_image_wall_gallery"                android:layout_width="fill_parent"                android:layout_height="wrap_content"                android:layout_alignParentLeft="true"                android:layout_alignParentTop="true"                android:fadingEdge="none"                android:spacing="1dip"                android:unselectedAlpha="1" >            </com.ejoy.customcontrol.HomeFoodGuideGallery>            <LinearLayout                android:id="@+id/homefood_gallery_point_linear"                android:layout_width="fill_parent"                android:layout_height="wrap_content"                android:layout_alignParentBottom="true"                android:layout_alignParentLeft="true"                android:gravity="center"                android:orientation="horizontal" >            </LinearLayout>        </RelativeLayout>        <ImageView            android:id="@+id/homefood_ivline2"            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:layout_marginLeft="15dp"            android:layout_marginRight="15dp"            android:layout_marginTop="5dp"            android:contentDescription="@string/contentdesption"            android:scaleType="fitXY"            android:src="@drawable/line_01" />        <LinearLayout            android:id="@+id/homefood_linearLayout1"            android:layout_width="match_parent"            android:layout_height="60dp"            android:layout_marginTop="5dp" >            <ImageView                android:id="@+id/homefood_ivad3small"                android:layout_width="50dp"                android:layout_height="60dp"                android:layout_marginRight="1dp"                android:layout_weight="0.19"                android:contentDescription="@string/contentdesption"                android:scaleType="centerCrop"                android:src="@drawable/defaultejoycoupon" />            <ImageView                android:id="@+id/homefood_ivad4small"                android:layout_width="50dp"                android:layout_height="60dp"                android:layout_marginLeft="1dp"                android:layout_weight="0.19"                android:contentDescription="@string/contentdesption"                android:scaleType="centerCrop"                android:src="@drawable/defaultejoycoupon" />            <ImageView                android:id="@+id/homefood_ivad5small"                android:layout_width="50dp"                android:layout_height="60dp"                android:layout_marginLeft="1dp"                android:layout_marginRight="1dp"                android:layout_weight="0.19"                android:contentDescription="@string/contentdesption"                android:scaleType="centerCrop"                android:src="@drawable/defaultejoycoupon" />            <ImageView                android:id="@+id/homefood_ivad6small"                android:layout_width="50dp"                android:layout_height="60dp"                android:layout_weight="0.19"                android:contentDescription="@string/contentdesption"                android:scaleType="fitXY"                android:src="@drawable/defaultejoycoupon" />        </LinearLayout>        <LinearLayout            android:id="@+id/homefood_linearLayout2"            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:layout_marginTop="15dp"            android:orientation="vertical" >            <LinearLayout                android:id="@+id/homefood_linearLayout3"                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:gravity="bottom" >                <TextView                    android:id="@+id/homefood_tvemail"                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:layout_marginLeft="5dp"                    android:drawableLeft="@drawable/email"                    android:text="@string/joylinknews"                    android:textAppearance="?android:attr/textAppearanceMedium"                    android:textColor="@color/black"                    android:textSize="15dip" />            </LinearLayout>            <ImageView                android:id="@+id/homefood_ivline3"                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:layout_marginLeft="3dp"                android:layout_marginRight="3dp"                android:contentDescription="@string/contentdesption"                android:scaleType="fitXY"                android:src="@drawable/line_02" />        </LinearLayout>        <com.ejoy.customcontrol.LinearLayoutForListView            android:id="@+id/linearLayoutForListView2"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:cacheColorHint="#00000000"            android:orientation="vertical" >        </com.ejoy.customcontrol.LinearLayoutForListView>    </LinearLayout></ScrollView>

 

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent" >    <ImageView        android:id="@+id/gallery_image"        android:layout_width="fill_parent"        android:layout_height="fill_parent"        android:layout_alignParentLeft="true"        android:layout_alignParentTop="true"        android:contentDescription="@string/contentdesption" /></RelativeLayout>


 

	
				
		
原创粉丝点击