本文整理汇总了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));
}
}