码迷,mamicode.com
首页 > 其他好文 > 详细

支付宝九宫格

时间:2016-04-01 21:55:32      阅读:575      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/home_adapter_item"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_margin="0.0dip"
    android:background="@color/color_item_grid_bg">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_centerInParent="true"
        android:background="@null"
        android:padding="12.0dip">

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_centerHorizontal="true" />

        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/imageView"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="5.0dip"
            android:singleLine="true"
            android:textColor="#999999"
            android:textSize="12sp" />
    </RelativeLayout>

</RelativeLayout>
item
技术分享
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true">
        <shape android:shape="rectangle">
            <stroke android:width="1.0px" android:color="#e5e5e5" />

            <gradient android:angle="270.0" android:endColor="#ffe8ecef" android:startColor="#ffe8ecef" />
        </shape>
    </item>
    <item android:state_focused="true">
        <shape android:shape="rectangle">
            <gradient android:angle="270.0" android:endColor="#ffe8ecef" android:startColor="#ffe8ecef" />

            <stroke android:width="1.0px" android:color="#e5e5e5" />
        </shape>
    </item>
    <item>
        <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
            <!-- 连框颜色值 -->
            <item>
                <shape>
                    <solid android:color="@color/colorLine" />
                </shape>
            </item>
            <!-- 主体背景颜色值 -->
            <item android:bottom="1dp" android:left="0dp" android:right="1dp" android:top="0dp">
                <shape>
                    <solid android:color="#ffffff" />
                </shape>
            </item>
        </layer-list>
    </item>

</selector>
color_item_grid_bg.xml
 mGridView = (com.changim.patient.app.widget.MyGridView) view.findViewById(R.id.girdView);
  bottomAdapter = new HomeAdapter(getActivity());
  mGridView.setAdapter(bottomAdapter);

因为外面嵌套了srcoolView   为了完全展开gridView  所以自定义GridView

技术分享
package com.changim.patient.app.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;

/**
 * Created by Administrator on 2016/3/23.
 */
public class MyGridView extends GridView {
    public MyGridView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyGridView(Context context) {
        super(context);
    }

    public MyGridView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec);
    }

}
MyGridView

 

支付宝九宫格

标签:

原文地址:http://www.cnblogs.com/zzw1994/p/5346472.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!