當前位置: 首頁>>代碼示例>>Java>>正文


Java GridLayout.getChildCount方法代碼示例

本文整理匯總了Java中android.widget.GridLayout.getChildCount方法的典型用法代碼示例。如果您正苦於以下問題:Java GridLayout.getChildCount方法的具體用法?Java GridLayout.getChildCount怎麽用?Java GridLayout.getChildCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.GridLayout的用法示例。


在下文中一共展示了GridLayout.getChildCount方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: interruptPicDownload

import android.widget.GridLayout; //導入方法依賴的package包/類
protected void interruptPicDownload(GridLayout gridLayout) {

		for (int i = 0; i < gridLayout.getChildCount(); i++) {
			ImageView iv = (ImageView) gridLayout.getChildAt(i);
			if (iv != null) {
				Drawable drawable = iv.getDrawable();
				if (drawable instanceof PictureBitmapDrawable) {
					PictureBitmapDrawable downloadedDrawable = (PictureBitmapDrawable) drawable;
					IPictureWorker worker = downloadedDrawable.getBitmapDownloaderTask();
					if (worker != null) {
						((MyAsyncTask) worker).cancel(true);
					}
					iv.setImageDrawable(null);
				}
			}

		}
	}
 
開發者ID:lookwhatlook,項目名稱:WeiboWeiBaTong,代碼行數:19,代碼來源:AbstractAppListAdapter.java

示例2: interruptPicDownload

import android.widget.GridLayout; //導入方法依賴的package包/類
protected void interruptPicDownload(GridLayout gridLayout) {
    for (int i = 0; i < gridLayout.getChildCount(); i++) {
        ImageView iv = (ImageView) gridLayout.getChildAt(i);
        if (iv != null) {
            Drawable drawable = iv.getDrawable();
            if (drawable instanceof PictureBitmapDrawable) {
                PictureBitmapDrawable downloadedDrawable = (PictureBitmapDrawable) drawable;
                IPictureWorker worker = downloadedDrawable
                        .getBitmapDownloaderTask();
                if (worker != null) {
                    ((MyAsyncTask) worker).cancel(true);
                }
                iv.setImageDrawable(null);
            }
        }
    }
}
 
開發者ID:jas0nchen,項目名稱:X.Ray,代碼行數:18,代碼來源:TimeLineAdapter.java

示例3: interruptPicDownload

import android.widget.GridLayout; //導入方法依賴的package包/類
protected void interruptPicDownload(GridLayout gridLayout) {
    for (int i = 0; i < gridLayout.getChildCount(); i++) {
        ImageView iv = (ImageView) gridLayout.getChildAt(i);
        if (iv != null) {
            Drawable drawable = iv.getDrawable();
            if (drawable instanceof PictureBitmapDrawable) {
                PictureBitmapDrawable downloadedDrawable
                        = (PictureBitmapDrawable) drawable;
                IPictureWorker worker = downloadedDrawable.getBitmapDownloaderTask();
                if (worker != null) {
                    ((MyAsyncTask) worker).cancel(true);
                }
                iv.setImageDrawable(null);
            }
        }
    }
}
 
開發者ID:shawnlinboy,項目名稱:siciyuan,代碼行數:18,代碼來源:AbstractAppListAdapter.java

示例4: setChildrenOnClickListener

import android.widget.GridLayout; //導入方法依賴的package包/類
private void setChildrenOnClickListener(AppCompatRadioButton child) {
    GridLayout parent = (GridLayout) child.getParent();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View v = parent.getChildAt(i);
        if (v instanceof AppCompatRadioButton) {
            if (((RadioButton) v).isChecked()) {
                activeRadioButton = (AppCompatRadioButton) v;
            }
            v.setOnClickListener(this);
        }
    }
}
 
開發者ID:willowtreeapps,項目名稱:spruce-android,代碼行數:14,代碼來源:RadioGroupGridLayout.java

示例5: onWindowFocusChanged

import android.widget.GridLayout; //導入方法依賴的package包/類
@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);

    // GridLayout內のアイテムをレイアウトサイズに合わせてストレッチ
    final GridLayout gl = (GridLayout) findViewById(R.id.calcFrame);
    int childWidth = gl.getWidth() / gl.getColumnCount();
    int childHeight = gl.getHeight() / gl.getRowCount();
    for (int i = 0; i < gl.getChildCount(); i++) {
        gl.getChildAt(i).setMinimumWidth(childWidth);
        gl.getChildAt(i).setMinimumHeight(childHeight);
    }
}
 
開發者ID:yokmama,項目名稱:honki_android2,代碼行數:14,代碼來源:MainActivity.java

示例6: setColumnCount

import android.widget.GridLayout; //導入方法依賴的package包/類
private void setColumnCount(GridLayout answerarea, int count) {
    List<View> kids = new ArrayList<>();
    for(int i = 0; i< answerarea.getChildCount(); i++) {
        kids.add(answerarea.getChildAt(i));
    }
    answerarea.removeAllViews();

    answerarea.setColumnCount(count);

    for (View k: kids) {
        k.setLayoutParams(new GridLayout.LayoutParams());
        answerarea.addView(k);
    }
}
 
開發者ID:quaap,項目名稱:Primary,代碼行數:15,代碼來源:StdGameActivity.java

示例7: markSorted

import android.widget.GridLayout; //導入方法依賴的package包/類
private void markSorted() {
    final GridLayout sortArea = (GridLayout) findViewById(R.id.sort_area);

    for (int i = 0; i < sortArea.getChildCount() - 1; i++) {
        int num1 = (int) sortArea.getChildAt(i).getTag();
        int num2 = (int) sortArea.getChildAt(i + 1).getTag();
        if (num1 > num2) {
            //sortArea.getChildAt(i).setBackgroundColor(Color.CYAN);
            sortArea.getChildAt(i+1).setBackgroundColor(Color.RED);
            //break;
        }

    }
}
 
開發者ID:quaap,項目名稱:Primary,代碼行數:15,代碼來源:SortingActivity.java

示例8: onCreateView

import android.widget.GridLayout; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = (GridLayout) inflater.inflate(R.layout.fragment_drum_grid, container, false);

    for (int i = 0; i < rootView.getChildCount(); i++) {
        DrumPad dp = (DrumPad) rootView.getChildAt(i);
        dp.init(MainActivity.config.gridDrumSounds[i], DrumFragment.isEditMode);
    }

    return rootView;
}
 
開發者ID:Ag47,項目名稱:TrueTone,代碼行數:12,代碼來源:DrumGridFragment.java

示例9: selectTheme

import android.widget.GridLayout; //導入方法依賴的package包/類
public void selectTheme(View view) {
    GridLayout grid = (GridLayout) view.getParent();
    int selection = grid.indexOfChild(view);
    for (int i = 0; i < grid.getChildCount(); i++)
        grid.getChildAt(i).setSelected(false);
    view.setSelected(true);
    selectTheme(selection, true);
}
 
開發者ID:QuickLyric,項目名稱:QuickLyric,代碼行數:9,代碼來源:SettingsActivity.java

示例10: playAgain

import android.widget.GridLayout; //導入方法依賴的package包/類
public void playAgain(View view) {

        gameIsActive = true;

        LinearLayout layout = (LinearLayout)findViewById(R.id.playAgainLayout);

        layout.setVisibility(View.INVISIBLE);

        activePlayer = 0;

        for (int i = 0; i < gameState.length; i++) {

            gameState[i] = 2;

        }

        GridLayout gridLayout = (GridLayout)findViewById(R.id.gridLayout);

        for (int i = 0; i< gridLayout.getChildCount(); i++) {

            ((ImageView) gridLayout.getChildAt(i)).setImageResource(0);

        }

    }
 
開發者ID:adi23arora,項目名稱:awesome-android-games,代碼行數:26,代碼來源:MainActivity.java

示例11: checkDone

import android.widget.GridLayout; //導入方法依賴的package包/類
private void checkDone() {
    if (!problemDone) {
        final GridLayout sortArea = (GridLayout) findViewById(R.id.sort_area);

        boolean sorted = true;

        for (int i = 0; i < sortArea.getChildCount() - 1; i++) {
            int num1 = (int) sortArea.getChildAt(i).getTag();
            int num2 = (int) sortArea.getChildAt(i + 1).getTag();
            if (num1 > num2) {
                sorted = false;
                break;
            }

        }
        if (sorted) {
            cancelHint();
            problemDone = true;
            stopTimer();


            for (int i = 0; i < sortArea.getChildCount(); i++) {
                final int c = i;
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        sortArea.getChildAt(c).setBackgroundColor(Color.GREEN);
                    }
                }, (c + 1) * 1000 / sortArea.getChildCount());
            }


            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    finishDone();
                }
            }, 1200);
        }
    }

}
 
開發者ID:quaap,項目名稱:Primary,代碼行數:43,代碼來源:SortingActivity.java

示例12: showDialog

import android.widget.GridLayout; //導入方法依賴的package包/類
@Override
public void showDialog(Bundle state) {
    if (getEntryValues() == null) {
        throw new IllegalStateException(
                "ColorGridPreference requires an entryValues array.");
    }

    if (originalValue == null)
        originalValue = getValue();
    final int preselect = findIndexOfValue(getValue());
    AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
            .setTitle(getDialogTitle())
            .setIcon(getDialogIcon())
            .setCancelable(true)
            .setNegativeButton(android.R.string.cancel, (dialog, which) -> {
                onDialogClosed(false);
                dialog.cancel();
            })
            .setPositiveButton(android.R.string.ok, (dialog, which) -> {
                onDialogClosed(true);
                dialog.dismiss();
            })
            .setView(R.layout.theme_dialog);
    PreferenceManager pm = getPreferenceManager();
    try {
        Method method = pm.getClass().getDeclaredMethod(
                "registerOnActivityDestroyListener",
                PreferenceManager.OnActivityDestroyListener.class);
        method.setAccessible(true);
        method.invoke(pm, this);
    } catch (Exception e) {
        e.printStackTrace();
    }

    mDialog = builder.create();
    mDialog.setCanceledOnTouchOutside(false);
    mDialog.getWindow().getAttributes().windowAnimations = android.R.anim.accelerate_interpolator;
    if (state != null)
        mDialog.onRestoreInstanceState(state);
    mDialog.show();

    GridLayout gridLayout = mDialog.findViewById(R.id.grid);
    gridLayout.getChildAt(preselect).setSelected(true);
    for (int i = 0; i < gridLayout.getChildCount(); i++) {
        gridLayout.getChildAt(i).setOnClickListener(v -> ((SettingsActivity) getContext()).selectTheme(v));
    }
}
 
開發者ID:QuickLyric,項目名稱:QuickLyric,代碼行數:48,代碼來源:ColorGridPreference.java


注:本文中的android.widget.GridLayout.getChildCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。