当前位置: 首页>>代码示例>>Java>>正文


Java GridView.setStretchMode方法代码示例

本文整理汇总了Java中android.widget.GridView.setStretchMode方法的典型用法代码示例。如果您正苦于以下问题:Java GridView.setStretchMode方法的具体用法?Java GridView.setStretchMode怎么用?Java GridView.setStretchMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.GridView的用法示例。


在下文中一共展示了GridView.setStretchMode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: EmoticonPageView

import android.widget.GridView; //导入方法依赖的package包/类
public EmoticonPageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.item_emoticonpage, this);
    mGvEmotion = (GridView) view.findViewById(R.id.gv_emotion);

    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
        mGvEmotion.setMotionEventSplittingEnabled(false);
    }
    mGvEmotion.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
    mGvEmotion.setCacheColorHint(0);
    mGvEmotion.setSelector(new ColorDrawable(Color.TRANSPARENT));
    mGvEmotion.setVerticalScrollBarEnabled(false);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:EmoticonPageView.java

示例2: EmoticonPageView

import android.widget.GridView; //导入方法依赖的package包/类
public EmoticonPageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.kf5_emoticon_page, this);
    mGvEmotion = (GridView) view.findViewById(R.id.kf5_grid_view_emotion);

    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
        mGvEmotion.setMotionEventSplittingEnabled(false);
    }
    mGvEmotion.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
    mGvEmotion.setCacheColorHint(0);
    mGvEmotion.setSelector(new ColorDrawable(Color.TRANSPARENT));
    mGvEmotion.setVerticalScrollBarEnabled(false);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:15,代码来源:EmoticonPageView.java

示例3: onCreateView

import android.widget.GridView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    provider = getArguments().getParcelable(ARG_PROVIDER);
    String result = getSQLResult(getContext(), provider, getString(R.string.sql_injection));
    View rootView = inflater.inflate(R.layout.fragment_details_schema, container, false);
    if (getStatus(result)==100){
        //TODO add image view
        rootView.findViewById(R.id.tv_schema).setVisibility(View.VISIBLE);
    } else {
        LinearLayout linearLayout = (LinearLayout) rootView.findViewById(R.id.ll);
        Map<String, List<List<String>>> resultToMap = parseResultToMap(result);
        for (String name: resultToMap.keySet()){
            TextView tv = getFilledTextView(getContext(),name);
            linearLayout.addView(tv);
            GridView grid = new GridView(getContext());
            grid.setNumColumns(3);
            grid.setHorizontalSpacing(10);
            grid.setVerticalSpacing(10);
            grid.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
            grid.setGravity(View.TEXT_ALIGNMENT_CENTER);
            List<List<String>> list = resultToMap.get(name);
            grid.setAdapter(new GridAdapter(getContext(),list));
            grid.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, list.size()*35)); //TODO: remove int value
            linearLayout.addView(grid);
        }
    }
    return rootView;
}
 
开发者ID:AlexeyZatsepin,项目名称:CP-Tester,代码行数:30,代码来源:SchemaFragment.java

示例4: EmoticonPageView

import android.widget.GridView; //导入方法依赖的package包/类
public EmoticonPageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(ResourceUtils.getIdByName(context,"layout","sobot_item_emoticonpage"), this);
    mGvEmotion = (GridView) view.findViewById(ResourceUtils.getIdByName(context,"id", "sobot_gv_emotion"));

    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
        mGvEmotion.setMotionEventSplittingEnabled(false);
    }
    mGvEmotion.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
    mGvEmotion.setCacheColorHint(0);
    mGvEmotion.setSelector(new ColorDrawable(Color.TRANSPARENT));
    mGvEmotion.setVerticalScrollBarEnabled(false);
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:15,代码来源:EmoticonPageView.java

示例5: showThemeDialog

import android.widget.GridView; //导入方法依赖的package包/类
public void showThemeDialog(final Activity context, final String index){
    AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.ChangeThemeDialog);
    builder.setTitle("更换主题");
    Integer[] res = new Integer[]{R.drawable.red_round, R.drawable.brown_round, R.drawable.blue_round,
            R.drawable.blue_grey_round, R.drawable.yellow_round, R.drawable.deep_purple_round,
            R.drawable.pink_round, R.drawable.green_round, R.drawable.deep_orange_round,
            R.drawable.grey_round, R.drawable.cyan_round, R.drawable.amber_round};
    List<Integer> list = Arrays.asList(res);
    ColorsListAdapter adapter = new ColorsListAdapter(context, list);
    adapter.setCheckItem(ThemeUtils.getCurrentTheme(context).getIntValue());
    GridView gridView = (GridView) LayoutInflater.from(context).inflate(R.layout.colors_panel_layout, null);
    gridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
    gridView.setCacheColorHint(0);
    gridView.setAdapter(adapter);
    builder.setView(gridView);
    final AlertDialog dialog = builder.show();
    gridView.setOnItemClickListener(
            new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    dialog.dismiss();
                    int value = ThemeUtils.getCurrentTheme(context).getIntValue();
                    Log.d("wxl", "value==" + value);
                    if (value != position) {
                        PreferenceUtils.setPreferenceInt(context,PreferenceUtils.THEME_KEY, position);
                        PreferenceUtils.setPreferenceString(context,PreferenceUtils.MAIN_INDEX_MENU,index);
                        context.getWindow().setWindowAnimations(R.style.WindowAnimationFadeInOut);
                        context.recreate();
                    }
                }
            }
    );
}
 
开发者ID:lueans,项目名称:LueansRead,代码行数:34,代码来源:ShowDialog.java


注:本文中的android.widget.GridView.setStretchMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。