解决思路:最终,我是这样解决的,当数据为1时候,不让滑动,为2时候,翻倍变为四,防止出现空白页,无限轮播点还是两个,完美解决。
具体解决方法:
很简单,不进行描述了,有点Android功底,应该能看懂,看不懂,说明不用心看,哈哈哈!
数据为1张的时候,继续滚动 ,1张变四张,这个简单了,就不补发代码了。
好了,贴代码,防止健忘。
Activity 代码:
<pre name="code" class="java">package com.lvche.origin.activity; import java.lang.ref.WeakReference; import java.util.ArrayList; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; import android.os.Message; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; import com.lvche.chatuidemo.R; import com.lvche.frame.utils.BitmapManage; import com.lvche.origin.activity.slide_imgs.ImageAdapter; import com.lvche.origin.activity.slide_imgs.ImageHandler; import com.lvche.origin.activity.slide_imgs.SlideViewPager; import com.umeng.socialize.utils.Log; public class TestActivity extends Activity { private static final String LOG_TAG = "TestActivity"; public ImageHandler handler = new ImageHandler(new WeakReference<TestActivity>(this)); public SlideViewPager viewPager; private int[] radioButtonID = null; private RadioGroup mGroup; ArrayList<ImageView> views = null; ImageView[] imgsViews = null; RadioButton[] radioButtons = null; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.correcting_pgg_home); //初始化 initViews(); initEvent(); } private void initEvent() { viewPager.setOnPageChangeListener(new MypageChangeListener()); viewPager.setCurrentItem(Integer.MAX_VALUE / 2 - (Integer.MAX_VALUE/2) % radioButtonID.length);//默认在中间,使用户看不到边界 //开始轮播效果 handler.sendEmptyMessageDelayed(ImageHandler.MSG_BREAK_SILENT, 300); } private void initViews() { viewPager = (SlideViewPager) findViewById(R.id.slide_viewpager); mGroup = (RadioGroup) findViewById(R.id.radioGroup1); LayoutInflater inflater = LayoutInflater.from(this); views = new ArrayList<ImageView>(); String listInfo = this.getSharedPreferences("SlideBannerImage", 0).getString("ImageInfo", null); String imgsUrl[] = null; String imgsHref[] = null; if (listInfo != null) { try { String list = new JSONObject(listInfo).getString("list"); JSONArray imgs = null; try { imgs = new JSONArray(list); } catch (Exception e) { Log.e("轮播图片只有一张,出现json转化失败"); return ; } imgsUrl = new String[imgs.length()]; imgsHref = new String[imgs.length()]; imgsViews = (imgs.length() == 2) ? new ImageView[imgs.length() + 2] : (imgs.length() == 1) ? new ImageView[imgs.length() + 3] : new ImageView[imgs.length()]; radioButtons = new RadioButton[imgs.length()]; radioButtonID = new int[imgs.length()]; for (int i = 0 ;i < imgs.length(); i++) { imgsViews[i] = (ImageView) inflater.inflate(R.layout.correcting_pgg_home_slide_item, null); radioButtons[i] = (RadioButton) inflater.inflate(R.layout.correcting_pgg_home_slide_item_radiobutton, null); radioButtons[i].setId(0Xbb+i); radioButtonID[i] = 0Xbb+i; radioButtons[i].setPadding(5, 0, 0, 0); mGroup.addView(radioButtons[i]); views.add(imgsViews[i]); } viewPager.setAdapter(new ImageAdapter(views)); for (int i=0 ; i < imgs.length() ; i++) { JSONObject json = new JSONObject(imgs.get(i).toString()); imgsUrl[i] = json.getString("Content"); imgsHref[i] = json.getString("LinkUrl"); BitmapManage.getInstance(this).get(imgsUrl[i], imgsViews[i]); } if (imgs.length() == 2) { imgsViews[2] = (ImageView) inflater.inflate(R.layout.correcting_pgg_home_slide_item, null); imgsViews[3] = (ImageView) inflater.inflate(R.layout.correcting_pgg_home_slide_item, null); views.add(imgsViews[2]); views.add(imgsViews[3]); BitmapManage.getInstance(this).get(imgsUrl[0], imgsViews[2]); BitmapManage.getInstance(this).get(imgsUrl[1], imgsViews[3]); } else if(imgs.length() == 1) { for(int i=1 ;i < 4 ; i++) { imgsViews[i] = (ImageView) inflater.inflate(R.layout.correcting_pgg_home_slide_item, null); views.add(imgsViews[i]); BitmapManage.getInstance(this).get(imgsUrl[0], imgsViews[i]); } } } catch (JSONException e) { e.printStackTrace(); } } } private class MypageChangeListener implements OnPageChangeListener { @Override public void onPageSelected(final int arg0) { mGroup.check(radioButtonID[arg0 % radioButtonID.length ]); handler.sendMessage(Message.obtain(handler, ImageHandler.MSG_PAGE_CHANGED, arg0, 0)); views.get(arg0 % radioButtonID.length ).findViewById(R.id.tuijian_header_img).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(TestActivity.this, arg0 % radioButtonID.length + "", 1000).show(); } }); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } //覆写该方法实现轮播效果的暂停和恢复 @Override public void onPageScrollStateChanged(int position) { switch (position) { case ViewPager.SCROLL_STATE_DRAGGING: handler.sendEmptyMessage(ImageHandler.MSG_KEEP_SILENT); break; case ViewPager.SCROLL_STATE_IDLE: handler.sendEmptyMessageDelayed(ImageHandler.MSG_UPDATE_IMAGE, ImageHandler.MSG_DELAY); break; default: break; } } } }
package com.lvche.origin.activity.slide_imgs; import java.util.ArrayList; import android.support.v4.view.PagerAdapter; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.widget.ImageView; public class ImageAdapter extends PagerAdapter{ private ArrayList<ImageView> viewlist; public ImageAdapter(ArrayList<ImageView> viewlist) { this.viewlist = viewlist; } @Override public int getCount() { //设置成最大,使用户看不到边界 return Integer.MAX_VALUE; } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0==arg1; } @Override public void destroyItem(ViewGroup container, int position, Object object) { //Warning:不要在这里调用removeView } @Override public Object instantiateItem(ViewGroup container, int position) { //对ViewPager页号求模取出View列表中要显示的项 position %= viewlist.size(); if (position < 0){ position = viewlist.size()+position; } ImageView view = viewlist.get(position); //如果View已经在之前添加到了一个父组件,则必须先remove,否则会抛出IllegalStateException。 ViewParent vp =view.getParent(); if (vp!=null){ ViewGroup parent = (ViewGroup)vp; parent.removeView(view); } container.addView(view); //add listeners here if necessary return view; } }
package com.lvche.origin.activity.slide_imgs; import java.lang.ref.WeakReference; import android.os.Handler; import android.os.Message; import android.util.Log; import com.lvche.origin.activity.TestActivity; public class ImageHandler extends Handler{ /** * 请求更新显示的View。 */ public static final int MSG_UPDATE_IMAGE = 1; /** * 请求暂停轮播。 */ public static final int MSG_KEEP_SILENT = 2; /** * 请求恢复轮播。 */ public static final int MSG_BREAK_SILENT = 3; /** * 记录最新的页号,当用户手动滑动时需要记录新页号,否则会使轮播的页面出错。 * 例如当前如果在第一页,本来准备播放的是第二页,而这时候用户滑动到了末页, * 则应该播放的是第一页,如果继续按照原来的第二页播放,则逻辑上有问题。 */ public static final int MSG_PAGE_CHANGED = 4; //轮播间隔时间 public static final long MSG_DELAY = 3000; //使用弱引用避免Handler泄露.这里的泛型参数可以不是Activity,也可以是Fragment等 private WeakReference<TestActivity> weakReference; private int currentItem = 0; public ImageHandler(WeakReference<TestActivity> wk){ weakReference = wk; } @Override public void handleMessage(Message msg) { super.handleMessage(msg); Log.d(getClass().getName(), "receive message" + msg.what); TestActivity activity = weakReference.get(); if (activity==null){ //Activity已经回收,无需再处理UI了 return ; } //检查消息队列并移除未发送的消息,这主要是避免在复杂环境下消息出现重复等问题。 if (activity.handler.hasMessages(MSG_UPDATE_IMAGE)){ activity.handler.removeMessages(MSG_UPDATE_IMAGE); } switch (msg.what) { case MSG_UPDATE_IMAGE: currentItem++; activity.viewPager.setCurrentItem(currentItem); //准备下次播放 activity.handler.sendEmptyMessageDelayed(MSG_UPDATE_IMAGE, MSG_DELAY); break; case MSG_KEEP_SILENT: //只要不发送消息就暂停了 break; case MSG_BREAK_SILENT: activity.handler.sendEmptyMessageDelayed(MSG_UPDATE_IMAGE, MSG_DELAY); break; case MSG_PAGE_CHANGED: //记录当前的页号,避免播放的时候页面显示不正确。 currentItem = msg.arg1; break; default: break; } } }
package com.lvche.origin.activity.slide_imgs; import com.lvche.chatuidemo.DemoApplication; import com.lvche.origin.activity.sliding_tab.ui.ViewPagerCompat.OnSingleTouchListener; import android.content.Context; import android.graphics.PointF; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.Toast; public class SlideViewPager extends ViewPager { //mViewTouchMode表示ViewPager是否全权控制滑动事件,默认为false,即不控制 private boolean mViewTouchMode = false; public SlideViewPager(Context context) { super(context); // TODO Auto-generated constructor stub } public SlideViewPager(Context context, AttributeSet attrs) { super(context, attrs); } public void setViewTouchMode(boolean b) { if (b && !isFakeDragging()) { //全权控制滑动事件 beginFakeDrag(); } else if (!b && isFakeDragging()) { //终止控制滑动事件 endFakeDrag(); } mViewTouchMode = b; } /** * 在mViewTouchMode为true的时候,ViewPager不拦截点击事件,点击事件将由子View处理 */ @Override public boolean onInterceptTouchEvent(MotionEvent event) { if (mViewTouchMode) { return false; } return super.onInterceptTouchEvent(event); } /** 解决viewpager 卡死问题 return false;可以重现 **/ PointF downPoint = new PointF(); OnSingleTouchListener onSingleTouchListener; @Override public boolean onTouchEvent(MotionEvent evt) { /*try { return super.onTouchEvent(ev); } catch (Exception e) { return false; }*/ switch (evt.getAction()) { case MotionEvent.ACTION_DOWN: // 记录按下时候的坐标 downPoint.x = evt.getX(); downPoint.y = evt.getY(); if (this.getChildCount() > 1) { //有内容,多于1个时 // 通知其父控件,现在进行的是本控件的操作,不允许拦截 getParent().requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_MOVE: if (this.getChildCount() > 1) { //有内容,多于1个时 // 通知其父控件,现在进行的是本控件的操作,不允许拦截 getParent().requestDisallowInterceptTouchEvent(true); } break; case MotionEvent.ACTION_UP: // 在up时判断是否按下和松手的坐标为一个点 if (PointF.length(evt.getX() - downPoint.x, evt.getY() - downPoint.y) < (float) 5.0) { onSingleTouch(this); return true; } break; } return super.onTouchEvent(evt); } public void onSingleTouch(View v) { if (onSingleTouchListener != null) { onSingleTouchListener.onSingleTouch(v); } } public interface OnSingleTouchListener { public void onSingleTouch(View v); } public void setOnSingleTouchListener( OnSingleTouchListener onSingleTouchListener) { this.onSingleTouchListener = onSingleTouchListener; } /** 注释上边内容 解决viewpager 卡死问题 return false;可以重现 **/ /** * 在mViewTouchMode为true或者滑动方向不是左右的时候,ViewPager将放弃控制点击事件, * 这样做有利于在ViewPager中加入ListView等可以滑动的控件,否则两者之间的滑动将会有冲突 */ @Override public boolean arrowScroll(int direction) { if (mViewTouchMode) return false; if (direction != FOCUS_LEFT && direction != FOCUS_RIGHT) { Toast.makeText(DemoApplication.getInstance().getApplicationContext(), "L-R", Toast.LENGTH_SHORT).show(); return false;} return super.arrowScroll(direction); } /* @Override protected boolean canScroll ( View v, boolean checkV, int dx, int x, int y ) { MyWebView view = ( MyWebView ) v.findViewById ( com.lvche.chatuidemo.R.id.baidu ) ; //res ID if ( view != null ) { return view.canScrollHorizontally ( -dx ) ; } else { return super.canScroll ( v, checkV, dx, x, y ) ; } } */ }
底部的radiobutton代码:
<?xml version="1.0" encoding="utf-8"?> <RadioButton xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:button="@drawable/btn_radio_holo_light1" android:checked="true" android:clickable="false" />
<?xml version="1.0" encoding="utf-8"?> <ImageView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/tuijian_header_img" android:layout_width="match_parent" android:layout_height="120dp" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:scaleType="fitXY" tools:ignore="ContentDescription" />
<pre name="code" class="java"><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true" android:background="#eeee" > <RelativeLayout android:id="@+id/topbanner" android:layout_width="match_parent" android:layout_height="@dimen/height_top_bar" android:background="@color/banner_bgcolor" android:gravity="center_vertical" > <LinearLayout android:id="@+id/top_left" android:layout_width="@dimen/width_back_bt" android:layout_height="match_parent" android:background="@drawable/common_tab_bg" > <ImageView android:id="@+id/top_left_menu" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:scaleType="centerInside" android:src="@drawable/mm_title_back" tools:ignore="ContentDescription" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="@dimen/height_top_bar" android:layout_gravity="center_horizontal" android:layout_marginLeft="@dimen/width_back_bt" android:background="@drawable/common_tab_bg" android:orientation="horizontal" > <EditText android:id="@+id/edit_note" android:layout_width="wrap_content" android:layout_height="30dp" android:layout_gravity="center_vertical" android:background="@drawable/button_normal_shape" android:drawableRight="@drawable/search_bar_icon_normal" android:focusableInTouchMode="false" android:focusable="false" android:hint="请输入关键字符 " android:paddingLeft="5dp" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:singleLine="true" android:textColor="#8C8C8C" android:textColorHint="#b3b3b3" android:textSize="15sp" tools:ignore="HardcodedText" /> </LinearLayout> <LinearLayout android:id="@+id/right_button" android:layout_width="@dimen/width_set_top_right" android:layout_height="@dimen/height_top_bar" android:layout_gravity="center_horizontal" android:layout_alignParentRight="true" android:layout_marginLeft="@dimen/width_back_bt" android:layout_centerVertical="true" android:background="@drawable/common_tab_bg" android:orientation="vertical" > <ImageView android:layout_width="25dp" android:layout_height="25dp" android:layout_marginTop="2dp" android:layout_gravity="center_vertical|center_horizontal" android:background="@drawable/logo_pgg" /> <Button android:id="@+id/topbanner_setting" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/common_tab_bg" android:text="扫一扫" android:layout_marginBottom="3dp" android:textColor="#fff" android:textSize="12sp" /> </LinearLayout> </RelativeLayout> </RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true" android:background="#ffffff" android:orientation="vertical" > <com.lvche.origin.view.HomeActivityTitleView android:id="@+id/homeTitle" android:layout_width="match_parent" android:layout_height="45dp" android:background="#fff888" /> <ScrollView android:layout_width="match_parent" android:scrollbars="none" android:layout_height="wrap_content" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:ignore="ScrollViewSize" > <!-- 滚动 轮播图片 --> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#ffffff" android:orientation="vertical" > <com.lvche.origin.activity.slide_imgs.SlideViewPager android:id="@+id/slide_viewpager" android:layout_width="match_parent" android:layout_height="120dp" android:background="#fff888" /> <RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/slide_viewpager" android:layout_centerHorizontal="true" android:button="@drawable/btn_radio_holo_light1" android:clickable="false" android:orientation="horizontal" > <!-- <RadioButton android:id="@+id/radio0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:button="@drawable/btn_radio_holo_light1" android:checked="true" android:clickable="false" /> <RadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:button="@drawable/btn_radio_holo_light1" android:clickable="false" /> <RadioButton android:id="@+id/radio2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:button="@drawable/btn_radio_holo_light1" android:clickable="false" /> <RadioButton android:id="@+id/radio3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:button="@drawable/btn_radio_holo_light1" android:clickable="false" /> <RadioButton android:id="@+id/radio4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:button="@drawable/btn_radio_holo_light1" android:clickable="false" /> --> </RadioGroup> </RelativeLayout> <!-- 滚动 轮播图片 end --> <!-- 地图导航 --> <LinearLayout android:layout_width="match_parent" android:layout_height="58dp" android:orientation="horizontal" > <ImageView android:layout_width="35dp" android:layout_height="35dp" android:layout_gravity="center_vertical" android:layout_marginLeft="25dp" android:background="@drawable/logo_pgg" /> <ImageView android:layout_width="30dp" android:layout_height="30dp" android:layout_gravity="center_vertical" android:layout_marginLeft="25dp" android:background="@drawable/logo_pgg" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="10dp" android:text="020国际皮革五金城导航" tools:ignore="HardcodedText" /> </LinearLayout> <ImageView android:layout_width="fill_parent" android:layout_height="1dp" android:background="#aaaaaa" /> <LinearLayout android:layout_width="match_parent" android:layout_height="58dp" android:orientation="horizontal" > <TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.21" android:src="@drawable/correcting_border" android:gravity="center_vertical|center_horizontal" android:text="-1F" android:textColor="#ffffff" android:textSize="25sp" android:background="#555fff" android:textStyle="bold" /> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.68" android:orientation="vertical" android:paddingLeft="6dp" > <TextView android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="0.59" android:gravity="center_vertical" android:text="富一层" android:textColor="#555555" android:textSize="18sp" tools:ignore="HardcodedText" /> <TextView android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" android:gravity="center_vertical" android:textColor="#999999" android:textSize="12sp" android:text="羊皮、山东大皮、进口头层" tools:ignore="HardcodedText" /> </LinearLayout> <ImageView android:layout_width="0dp" android:layout_height="25dp" android:layout_gravity="center_vertical" android:layout_weight="0.1" android:background="@drawable/logo_pgg" /> </LinearLayout> <ImageView android:layout_width="fill_parent" android:layout_height="1dp" android:background="#aaaaaa" /> <LinearLayout android:layout_width="match_parent" android:layout_height="58dp" android:orientation="horizontal" > <TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.21" android:src="@drawable/correcting_border" android:gravity="center_vertical|center_horizontal" android:text="1F" android:textColor="#ffffff" android:background="#8ffeee" android:textSize="25sp" android:textStyle="bold" /> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.68" android:orientation="vertical" android:paddingLeft="6dp" > <TextView android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="0.59" android:gravity="center_vertical" android:text="一层" android:textColor="#555555" android:textSize="18sp" tools:ignore="HardcodedText" /> <TextView android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" android:gravity="center_vertical" android:textColor="#999999" android:textSize="12sp" android:text="绵羊皮、山羊皮、超纤、PU革" tools:ignore="HardcodedText" /> </LinearLayout> <ImageView android:layout_width="0dp" android:layout_height="25dp" android:layout_gravity="center_vertical" android:layout_weight="0.1" android:background="@drawable/logo_pgg" /> </LinearLayout> <ImageView android:layout_width="fill_parent" android:layout_height="1dp" android:background="#aaaaaa" /> <LinearLayout android:layout_width="match_parent" android:layout_height="58dp" android:orientation="horizontal" > <TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.21" android:src="@drawable/correcting_border" android:gravity="center_vertical|center_horizontal" android:text="2F" android:background="#00ffaa" android:textColor="#ffffff" android:textSize="25sp" android:textStyle="bold" /> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.68" android:orientation="vertical" android:paddingLeft="6dp" > <TextView android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="0.59" android:gravity="center_vertical" android:text="二层" android:textColor="#555555" android:textSize="18sp" tools:ignore="HardcodedText" /> <TextView android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" android:gravity="center_vertical" android:textColor="#999999" android:textSize="12sp" android:text="插口、铁线扣、压铸件、其他小配件" tools:ignore="HardcodedText" /> </LinearLayout> <ImageView android:layout_width="0dp" android:layout_height="25dp" android:layout_gravity="center_vertical" android:layout_weight="0.1" android:background="@drawable/logo_pgg" /> </LinearLayout> <ImageView android:layout_width="fill_parent" android:layout_height="1dp" android:background="#aaaaaa" /> <LinearLayout android:layout_width="match_parent" android:layout_height="58dp" android:orientation="horizontal" > <TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.21" android:src="@drawable/correcting_border" android:gravity="center_vertical|center_horizontal" android:text="3F" android:textColor="#ffffff" android:background="#ff00ff" android:textSize="25sp" android:textStyle="bold" /> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.68" android:orientation="vertical" android:paddingLeft="6dp" > <TextView android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="0.59" android:gravity="center_vertical" android:text="三层" android:textColor="#555555" android:textSize="18sp" tools:ignore="HardcodedText" /> <TextView android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" android:gravity="center_vertical" android:textColor="#999999" android:textSize="12sp" android:text="中空钉、9字钉、其他小配件" tools:ignore="HardcodedText" /> </LinearLayout> <ImageView android:layout_width="0dp" android:layout_height="25dp" android:layout_gravity="center_vertical" android:layout_weight="0.1" android:background="@drawable/logo_pgg" /> </LinearLayout> <ImageView android:layout_width="fill_parent" android:layout_height="1dp" android:background="#aaaaaa" /> <!-- 地图导航 end --> <!-- 广告 --> <LinearLayout android:layout_width="match_parent" android:layout_height="58dp" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="10dp" android:textColor="#888888" android:text="新品发布" android:textSize="20sp" tools:ignore="HardcodedText" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="150dp" android:orientation="horizontal" android:layout_marginBottom="15dp" > <ImageView android:layout_height="fill_parent" android:layout_width="0dp" android:background="@drawable/logo_pgg" android:layout_weight="0.48" android:layout_marginRight="5dp" /> <LinearLayout android:layout_height="fill_parent" android:layout_width="0dp" android:orientation="vertical" android:layout_weight="0.5"> <ImageView android:layout_height="0dp" android:background="@drawable/e" android:layout_width="fill_parent" android:layout_weight="0.49" android:layout_marginBottom="5dp" /> <ImageView android:layout_height="0dp" android:background="@drawable/a" android:layout_width="fill_parent" android:layout_weight="0.49" /> </LinearLayout> </LinearLayout> <ImageView android:layout_width="match_parent" android:layout_height="80dp" android:background="@drawable/c" android:layout_marginBottom="15dp" /> <ImageView android:layout_width="match_parent" android:layout_height="80dp" android:background="@drawable/c" android:layout_marginBottom="15dp" /> <ImageView android:layout_width="match_parent" android:layout_height="80dp" android:background="@drawable/c" android:layout_marginBottom="15dp" /> <!-- 广告 end --> </LinearLayout> </ScrollView> </LinearLayout>