本文整理匯總了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);
}
示例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));
}
}
示例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));
}
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例8: clearSelectedState
import android.widget.Button; //導入方法依賴的package包/類
private void clearSelectedState(Button item) {
item.setSelected(false);
}
示例9: setSelectedState
import android.widget.Button; //導入方法依賴的package包/類
private void setSelectedState(Button cell) {
for (Button btn : mButtonItems) {
btn.setSelected((btn == cell));
}
}