本文整理汇总了Java中android.widget.Button.setAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setAlpha方法的具体用法?Java Button.setAlpha怎么用?Java Button.setAlpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.Button
的用法示例。
在下文中一共展示了Button.setAlpha方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeTypeButton
import android.widget.Button; //导入方法依赖的package包/类
private void changeTypeButton(Button button, int type) {
ImageView coins = (ImageView) mViewDetails.findViewById(R.id
.reward_coins_icon);
switch (type) {
case ENABLE_BUTTON:
coins.setAlpha(1);
button.setAlpha(1);
button.setEnabled(true);
break;
case DISABLE_BUTTON:
coins.setAlpha(ALPHA);
button.setAlpha(ALPHA);
button.setEnabled(false);
break;
default:
break;
}
}
示例2: getView
import android.widget.Button; //导入方法依赖的package包/类
@Override
public View getView(final int position, View convertView, final ViewGroup parent)
{
// inflate the layout for each list row
convertView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.cafe_food_item, parent, false);
// get current item to be displayed
final FoodItem currentItem = (FoodItem) getItem(position);
// get the TextView for item name and item description
TextView itemText = (TextView) convertView.findViewById(R.id.list_item_text);
itemText.setText(currentItem.getName());
TextView priceText = (TextView) convertView.findViewById(R.id.foodPrice);
priceText.setText("Price: " + currentItem.getPrice());
Button useButton = (Button) convertView.findViewById(R.id.list_item_btn);
useButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
((Cafe)game.getGameEnvironment().getOutdoorEnvironment(OptionType.CAFE_OPTION)).setSelectedFood((FoodItem)getItem(position));
finish();
}
});
// deactivate button if the player has not enough money
if (game.getPlayer().getStats().getStatByIndex(StatType.MONEY) < currentItem.getPrice())
{
useButton.setEnabled(false);
useButton.setAlpha(0.3f);
itemText.setText(currentItem.getName() + " (Not enough money!)");
}
// returns the view for the current row
return convertView;
}
示例3: setButton
import android.widget.Button; //导入方法依赖的package包/类
private void setButton(boolean enable) {
final SwitchButton vpnButton = (SwitchButton) findViewById(R.id.button_start_vpn);
final Button selectHosts = (Button) findViewById(R.id.button_select_hosts);
if (enable) {
vpnButton.setChecked(false);
selectHosts.setAlpha(1.0f);
selectHosts.setClickable(true);
} else {
vpnButton.setChecked(true);
selectHosts.setAlpha(.5f);
selectHosts.setClickable(false);
}
}
示例4: blinkDelayed
import android.widget.Button; //导入方法依赖的package包/类
public void blinkDelayed(Message msg) {
Button b = (Button) findViewById(msg.arg1);
b.setAlpha(0.4f);
new AudioPlayer().play(getApplicationContext(), SimonColorImpl.fromInt(msg.arg1).getSoundId());
Message m = MessageBuilder.withArg1(msg.what, msg.arg1);
presenter.handleBlinkDelayedMessage(m);
}
示例5: processButtonEvent
import android.widget.Button; //导入方法依赖的package包/类
/**
* Toggle visibility of previous and next buttons based on currently viewed feature info
* @param mainLayout LinearLayout
* @param featureContents List of FeatureContents
* @param calloutLayouts List of LinearLayouts
* @param layerTitle TextView representing title of layer where feature is located
* @param txtPopupCount TextView representing count of features identified
* @param btnNext Button for navigating to next feature
* @param btnPrev Button for navigating to previous feature
* @param btnName String representing flag for which button to process logic for
*/
private void processButtonEvent(final LinearLayout mainLayout, final List<FeatureContent> featureContents,
final List<LinearLayout> calloutLayouts, final TextView layerTitle, final TextView txtPopupCount, final Button btnNext, final Button btnPrev, final String btnName ){
int currentIndex = getCurrentLayoutId();
final View currentView = mainLayout.findViewById(currentIndex);
if (btnName.equalsIgnoreCase("next") && currentIndex < featureContents.size() - 1){
incrementCurrentLayoutId();
}else if (btnName.equalsIgnoreCase("prev") && currentIndex > 0){
decrementCurrentLayoutId();
}
final View newView = calloutLayouts.get(getCurrentLayoutId());
replaceView(mainLayout, currentView,newView);
// Reset the layer name in the callout
final FeatureContent activeContent = featureContents.get(getCurrentLayoutId());
final String layerName = activeContent.getLayerName();
// Clear any selections
clearSelections();
// Select the feature
activeContent.getFeatureLayer().selectFeature(activeContent.getFeature());
layerTitle.setText(layerName);
// Reset popup index
txtPopupCount.setText(getCurrentLayoutId() + 1 + " of " + featureContents.size() );
currentIndex = getCurrentLayoutId();
// Adjust visual cues for navigating features
if (currentIndex < featureContents.size() - 1){
btnNext.setAlpha(1.0f);
}else{
btnNext.setAlpha(0.3f);
}
if (currentIndex > 0){
btnPrev.setAlpha(1.0f);
}else{
btnPrev.setAlpha(0.3f);
}
}
示例6: resetButton
import android.widget.Button; //导入方法依赖的package包/类
public void resetButton(int buttonId) {
Button b = (Button)findViewById(buttonId);
b.setAlpha(1);
}