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