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


Java Button.setSelected方法代碼示例

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


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

示例1: initFootView

import android.widget.Button; //導入方法依賴的package包/類
private void initFootView(OrderTestModel serializable) {

        calcle = (Button) footView.findViewById(R.id.calcle);
        calcle.setSelected(true);
        calcle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                activity.finish();
            }
        });
        commitBtn = (Button) footView.findViewById(R.id.commitBtn);
        commitBtn.setOnClickListener(this);
        fayPerson = (FaultAnalysisView) footView.findViewById(R.id.fay_person);
        fay_custom = (FaultAnalysisView) footView.findViewById(R.id.fay_custom);
        //設置繪畫開關
        fayPerson.setCanPaint(true);
        fay_custom.setCanPaint(true);

    }
 
開發者ID:fengdongfei,項目名稱:CXJPadProject,代碼行數:20,代碼來源:TwentyTestFragment.java

示例2: onClick

import android.widget.Button; //導入方法依賴的package包/類
@OnClick({R.id.make_slot_select_1_button, R.id.make_slot_select_2_button, R.id.make_slot_select_3_button})
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.make_slot_select_1_button:
            slotRoom.setHitRatio(0.10);
            break;
        case R.id.make_slot_select_2_button:
            slotRoom.setHitRatio(0.125);
            break;
        case R.id.make_slot_select_3_button:
            slotRoom.setHitRatio(0.15);
            break;
    }

    Button[] buttons = {selectButton1, selectButton2, selectButton3};
    for (Button button: buttons) {
        button.setSelected(view.equals(button));
    }
}
 
開發者ID:SlotNSlot,項目名稱:SlotNSlot_Android,代碼行數:20,代碼來源:MakeSlotStepOneFragment.java

示例3: onClick

import android.widget.Button; //導入方法依賴的package包/類
@OnClick({R.id.make_slot_select_1_button, R.id.make_slot_select_2_button, R.id.make_slot_select_3_button})
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.make_slot_select_1_button:
            slotRoom.setMaxWinPrize(1000);
            break;
        case R.id.make_slot_select_2_button:
            slotRoom.setMaxWinPrize(1500);
            break;
        case R.id.make_slot_select_3_button:
            slotRoom.setMaxWinPrize(2000);
            break;
    }

    Button[] buttons = {selectButton1, selectButton2, selectButton3};
    for (Button button: buttons) {
        button.setSelected(view.equals(button));
    }
}
 
開發者ID:SlotNSlot,項目名稱:SlotNSlot_Android,代碼行數:20,代碼來源:MakeSlotStepThreeFragment.java

示例4: show

import android.widget.Button; //導入方法依賴的package包/類
public void show() {
    super.show();

    int i = 0;
    Button btn = null;
    Iterator<Button> iterator = mButtons.iterator();
    while (iterator.hasNext()) {
        Button button = iterator.next();
        if(button.getVisibility() != View.VISIBLE) {
            continue;
        }
        ++i;
        btn = button;
    }
    if (i == 1) {
        btn.setBackgroundResource(R.drawable.btn_dialog_single);
    }
    if (i == 2) {
        btn.setSelected(true);
        ((ViewGroup.MarginLayoutParams)(this.mButtons.get(0)).getLayoutParams()).rightMargin = 1;
    }
    if (i == 3)  {
        btn.setSelected(true);
        ((ViewGroup.MarginLayoutParams)(this.mButtons.get(2)).getLayoutParams()).leftMargin = 1;
        ((ViewGroup.MarginLayoutParams)(this.mButtons.get(0)).getLayoutParams()).rightMargin = 1;
    }

}
 
開發者ID:NewCasino,項目名稱:browser,代碼行數:29,代碼來源:ECAlertDialog.java

示例5: collapse

import android.widget.Button; //導入方法依賴的package包/類
/**
 * change to collapse image of button and display meal information
 *
 * @param when Integer constant of meal time to collapse
 */
private void collapse(int when) {
    TextView textView = null;
    Button button = null;
    String mealMenu = null;

    switch (when) {
        case BREAKFAST:
            textView = mBreakfastTV;
            button = mBreakfastExpandBtn;
            if (mSelectedDayMeal != null) mealMenu = mSelectedDayMeal.getBreakfast();
            break;
        case LUNCH:
            textView = mLunchTV;
            button = mLunchExpandBtn;
            if (mSelectedDayMeal != null) mealMenu = mSelectedDayMeal.getLunch();
            break;
        case DINNER:
            textView = mDinnerTV;
            button = mDinnerExpandBtn;
            if (mSelectedDayMeal != null) mealMenu = mSelectedDayMeal.getDinner();
            break;
        default:
            break;
    }

    textView.setText(mealMenu);
    button.setText(R.string.meal_allergy);

    Drawable moreDrawable =
            ContextCompat.getDrawable(getContext(), R.drawable.ic_expand_more_white_18dp);
    button.setCompoundDrawablesWithIntrinsicBounds(null, null, moreDrawable, null);

    button.setSelected(false);
}
 
開發者ID:DSM-DMS,項目名稱:DMS,代碼行數:40,代碼來源:MealFragment.java

示例6: expand

import android.widget.Button; //導入方法依賴的package包/類
/**
 * change to expand image of button and display allergy information
 *
 * @param when Integer constant of meal time to expand
 */
private void expand(int when) {
    TextView textView = null;
    Button button = null;
    String mealAllergy = null;

    switch (when) {
        case BREAKFAST:
            textView = mBreakfastTV;
            button = mBreakfastExpandBtn;
            if (mSelectedDayMeal != null) mealAllergy = mSelectedDayMeal.getBreakfastAllergy();
            break;
        case LUNCH:
            textView = mLunchTV;
            button = mLunchExpandBtn;
            if (mSelectedDayMeal != null) mealAllergy = mSelectedDayMeal.getLunchAllergy();
            break;
        case DINNER:
            textView = mDinnerTV;
            button = mDinnerExpandBtn;
            if (mSelectedDayMeal != null) mealAllergy = mSelectedDayMeal.getDinnerAllergy();
            break;
        default:
            break;
    }

    textView.setText(mealAllergy);
    button.setText(R.string.meal_meal);

    Drawable lessDrawable =
            ContextCompat.getDrawable(getContext(), R.drawable.ic_expand_less_white_18dp);
    lessDrawable.setColorFilter(
            ContextCompat.getColor(getContext(), R.color.colorPrimary), PorterDuff.Mode.MULTIPLY);
    button.setCompoundDrawablesWithIntrinsicBounds(null, null, lessDrawable, null);

    button.setSelected(true);
}
 
開發者ID:DSM-DMS,項目名稱:DMS,代碼行數:42,代碼來源:MealFragment.java

示例7: onCreate

import android.widget.Button; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // 取得地圖物件
    setContentView(R.layout.activity_maps);
    mLayoutContainer = (ViewGroup) findViewById(R.id.layout_container);
    mMapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
    mMapFragment.getMapAsync(this);

    // For tracking, Create an instance of GoogleAPIClient and LocationRequest.
    configGoogleApiClient();
    configLocationRequest();

    // Buttons on map
    mSwitchBtn = (Button) findViewById(R.id.btn_switch);
    mTrackingBtn = (Button) findViewById(R.id.btn_tracking);
    mPickTilesBtn = (Button) findViewById(R.id.btn_pick_tiles);
    mGpxManagerBtn = (Button) findViewById(R.id.btn_gpx_files_list);
    mPoiSearchBtn = (Button) findViewById(R.id.btn_search);

    mBtnsSet.add(mPickTilesBtn);
    mBtnsSet.add(mTrackingBtn);
    mBtnsSet.add(mGpxManagerBtn);
    mBtnsSet.add(mPoiSearchBtn);

    mSwitchBtn.setOnClickListener(this);
    for (View btn : mBtnsSet) {
        btn.setOnClickListener(this);
    }

    // Add center cross into main map
    mCrossSet.add(MAP_CODE_MAIN, (ImageView) findViewById(R.id.cross));

    // 取得ActionBar
    mActionBar = getSupportActionBar();

    // 還原各項設定
    SharedPreferences prefs = getSharedPreferences(PREFS_NAME, 0);
    // 檢查是否紀錄航跡中
    mTrackingBtn.setSelected(prefs.getBoolean("isTracking", false));
    if (mTrackingBtn.isSelected()) {
        // bind TrackingService
        Intent bindIntent = new Intent(this, TrackingService.class);
        bindService(bindIntent, this, BIND_AUTO_CREATE);
    }

    // 取得上次相機位置
    LatLng lastTarget = new LatLng(prefs.getFloat(
            "cameraLat", (float) TAIWAN_CENTER.latitude),
            prefs.getFloat("cameraLon", (float) TAIWAN_CENTER.longitude));
    Float lastZoom = prefs.getFloat("cameraZoom", STARTING_ZOOM);
    lastCameraPosition = new CameraPosition(lastTarget, lastZoom, 0, 0);

    // 取得已開啟的GPX檔案
    mGpxFileList = prefs.getStringSet("gpxFiles", mGpxFileList);

    // 取得POI檔案
    poiFile = prefs.getString("poiFile", null);

    // 取得離線地圖檔案
    mapFile = prefs.getString("mapFile", null);
    themeFile = prefs.getString("themeFile", null);

    // 還原座標表示設定
    CoorSysList.coorSetting = prefs.getInt("coorSetting", COOR_WGS84_D);
}
 
開發者ID:typebrook,項目名稱:FiveMinsMore,代碼行數:68,代碼來源:MapsActivity.java

示例8: clearSelectedState

import android.widget.Button; //導入方法依賴的package包/類
private void clearSelectedState(Button item) {
    item.setSelected(false);
}
 
開發者ID:parkingwang,項目名稱:vehicle-keyboard-android,代碼行數:4,代碼來源:InputView.java

示例9: setSelectedState

import android.widget.Button; //導入方法依賴的package包/類
private void setSelectedState(Button cell) {
    for (Button btn : mButtonItems) {
        btn.setSelected((btn == cell));
    }
}
 
開發者ID:parkingwang,項目名稱:vehicle-keyboard-android,代碼行數:6,代碼來源:InputView.java


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