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


Java Button.setAlpha方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:19,代碼來源:AwardDetailsFragment.java

示例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;
}
 
開發者ID:serhataras,項目名稱:Roomie,代碼行數:37,代碼來源:CafeActivity.java

示例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);
    }
}
 
開發者ID:x-falcon,項目名稱:Virtual-Hosts,代碼行數:14,代碼來源:MainActivity.java

示例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);
}
 
開發者ID:simoneapp,項目名稱:S3-16-simone,代碼行數:8,代碼來源:GameActivityImpl.java

示例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);
  }
}
 
開發者ID:Esri,項目名稱:mapbook-android,代碼行數:56,代碼來源:MapFragment.java

示例6: resetButton

import android.widget.Button; //導入方法依賴的package包/類
public void resetButton(int buttonId) {
    Button b = (Button)findViewById(buttonId);
    b.setAlpha(1);
}
 
開發者ID:simoneapp,項目名稱:S3-16-simone,代碼行數:5,代碼來源:GameActivityImpl.java


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