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


Java Button.setTypeface方法代碼示例

本文整理匯總了Java中android.widget.Button.setTypeface方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.setTypeface方法的具體用法?Java Button.setTypeface怎麽用?Java Button.setTypeface使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.Button的用法示例。


在下文中一共展示了Button.setTypeface方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.widget.Button; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.play_again);
   //Initialize
    playAgain = (Button) findViewById(R.id.playAgainButton);
    wrongAnsText = (TextView)findViewById(R.id.wrongAns);

    //play again button onclick listener
    playAgain.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent(PlayAgain.this, MainGameActivity.class);
            startActivity(intent);
            finish();
        }
    });

    //Setting typefaces for textview and button - this will give stylish fonts on textview and button
    Typeface typeface = Typeface.createFromAsset(getAssets(),"fonts/shablagooital.ttf");
    playAgain.setTypeface(typeface);
    wrongAnsText.setTypeface(typeface);
}
 
開發者ID:sarveshchavan7,項目名稱:Quiz-Game,代碼行數:24,代碼來源:PlayAgain.java

示例2: addButton

import android.widget.Button; //導入方法依賴的package包/類
@RequiresApi(api = VERSION_CODES.JELLY_BEAN)
private void addButton() {
    Button button = (Button) mViewDetails.findViewById(R.id.reward_details_buy_button);
    button.setTypeface(null, Typeface.BOLD);
    changeTypeButton(button,
            mAward.getPrice() > UserAdapter.getCurrentUser().getCoins() ? DISABLE_BUTTON
                    : ENABLE_BUTTON);
    button.setOnClickListener(new OnClickListener() {
        @RequiresApi(api = VERSION_CODES.JELLY_BEAN)
        @Override
        public void onClick(View v) {
            mAwardAdapter.exchangeAward(mAward.getAwardAuthToken(), new RewardCallback() {
                @Override
                public void onSuccess(Reward reward) {
                    showRewardDialog(reward);
                    Snackbar.make(mViewDetails, getString(R.string.dialog_award_bought),
                            Snackbar.LENGTH_SHORT).show();
                }

                @Override
                public void onFailure() {
                    Snackbar.make(mViewDetails, getString(R.string.problem_award),
                            Snackbar.LENGTH_SHORT).show();
                }
            });
        }
    });
}
 
開發者ID:ArnauBlanch,項目名稱:civify-app,代碼行數:29,代碼來源:AwardDetailsFragment.java

示例3: onCreate

import android.widget.Button; //導入方法依賴的package包/類
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_item);




    addCostBtn = (Button) findViewById(R.id.add_cost_button);
    addEarnBtn = (Button) findViewById(R.id.add_earn_button);
    addFinishBtn   = (ImageButton) findViewById(R.id.add_finish);
    addDescription = (ImageButton) findViewById(R.id.add_description);
    clearBtn = (Button) findViewById(R.id.clear);
    words = (TextView) findViewById(R.id.anime_words);
    // 設置字體顏色
    Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/chinese_character.ttf");
    clearBtn.setTypeface(typeface);
    words.setTypeface(typeface);
    // 設置按鈕監聽
    addCostBtn.setOnClickListener(new ButtonListener());
    addEarnBtn.setOnClickListener(new ButtonListener());
    addFinishBtn.setOnClickListener(new ButtonListener());
    addDescription.setOnClickListener(new ButtonListener());
    clearBtn.setOnClickListener(new ButtonListener());


    bannerText = (TextView) findViewById(R.id.chosen_title);
    bannerImage = (ImageView) findViewById(R.id.chosen_image);

    moneyText = (TextView) findViewById(R.id.input_money_text);
    // 及時清零
    moneyText.setText("0.00");

    manager = getSupportFragmentManager();

    transaction = manager.beginTransaction();
    transaction.replace(R.id.item_fragment, new CostFragment());
    transaction.commit();

}
 
開發者ID:yuukidach,項目名稱:Ucount,代碼行數:40,代碼來源:AddItemActivity.java

示例4: findViewids

import android.widget.Button; //導入方法依賴的package包/類
private void findViewids() {
	txtApp = (TextView) findViewById(R.id.txtAppName);
	txtApp.setTypeface(ManagerTypeface.getTypeface(VerifyOTP.this, R.string.typeface_android));
	txtOTPNote = (TextView) findViewById(R.id.txtvalidateOtp);
	txtOTPNote.setTypeface(ManagerTypeface.getTypeface(VerifyOTP.this, R.string.typeface_roboto_regular));
	layBack = (RelativeLayout)findViewById(R.id.layBack);
	txtTimer = (TextView)findViewById(R.id.txttimer);
	txtTimer.setTypeface(ManagerTypeface.getTypeface(VerifyOTP.this, R.string.typeface_roboto_regular));
	btnResend = (Button)findViewById(R.id.btnResendOTP);
	btnResend.setTypeface(ManagerTypeface.getTypeface(VerifyOTP.this, R.string.typeface_roboto_regular));
	txtMobile = (TextView)findViewById(R.id.txtMobile);
	txtMobile.setTypeface(ManagerTypeface.getTypeface(VerifyOTP.this, R.string.typeface_roboto_regular));
	edtOTP = (MaterialEditText)findViewById(R.id.edtOTP);
	edtOTP.setTypeface(ManagerTypeface.getTypeface(VerifyOTP.this, R.string.typeface_roboto_regular));
	//edtOTP.setText(shared.getSharedValue("mOTP"));
	btnVerifyOTP = (ImageView)findViewById(R.id.btn_verify_otp);
	layUserDetails = (CardView) findViewById(R.id.layUserDetails);
	edtName  =(MaterialEditText)findViewById(R.id.edtName);
	edtName.setTypeface(ManagerTypeface.getTypeface(VerifyOTP.this, R.string.typeface_roboto_regular));
	relAlreadyUser = (RelativeLayout)findViewById(R.id.relAlreadyUser);
	layNewUser = (LinearLayout)findViewById(R.id.layNewUser);
	btnCreate = (Button)findViewById(R.id.btnCreateAccount);
	btnCreate.setTypeface(ManagerTypeface.getTypeface(VerifyOTP.this, R.string.typeface_roboto_regular));
	txtIAgree = (TextView)findViewById(R.id.txtTermsCondt);
	txtIAgree.setTypeface(ManagerTypeface.getTypeface(VerifyOTP.this, R.string.typeface_roboto_regular));
	countDownTimer = new MyCountDownTimer(startTime, interval);
       txtTimer.setText(String.valueOf(startTime / 1000)+"s");
       spEmail = (MaterialSpinner)findViewById(R.id.spEmail);
       countDownTimer.start();
       setAdapter();
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:32,代碼來源:VerifyOTP.java

示例5: findView

import android.widget.Button; //導入方法依賴的package包/類
private void findView(){
    txtThisVersion = (TextView)findViewById(R.id.txtThisVersionOf);
    txtThisVersion.setTypeface(ManagerTypeface.getTypeface(AppUpdate.this, R.string.typeface_roboto_regular));
    btnDownload    = (Button)findViewById(R.id.btnDownloadApp);
    btnDownload.setTypeface(ManagerTypeface.getTypeface(AppUpdate.this, R.string.typeface_roboto_regular));
    txtAppUpdate = (TextView)findViewById(R.id.txtAppUpdateMainHead);

}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:9,代碼來源:AppUpdate.java

示例6: setupButtonsFontStyle

import android.widget.Button; //導入方法依賴的package包/類
/**
 * Sets buttons font style by setting an appropriate typeface.
 */
private void setupButtonsFontStyle() {
    Typeface typeface = MBApp.getApp().getTypeface();

    Button connectButton = (Button) findViewById(R.id.connect_device_btn);
    connectButton.setTypeface(typeface);
    Button flashButton = (Button) findViewById(R.id.flash_microbit_btn);
    flashButton.setTypeface(typeface);
    Button createCodeButton = (Button) findViewById(R.id.create_code_btn);
    createCodeButton.setTypeface(typeface);
    Button discoverButton = (Button) findViewById(R.id.discover_btn);
    discoverButton.setTypeface(typeface);
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:16,代碼來源:HomeActivity.java

示例7: onCreate

import android.widget.Button; //導入方法依賴的package包/類
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_reg);

        //xmlファイルとの紐づけ
        btn_issue = (Button)findViewById(R.id.button_issue);
        hidebtn_reset = (Button)findViewById(R.id.hide_button);
        btn_share = (ImageButton)findViewById(R.id.button_share);
        btn_findmode = (ImageButton)findViewById(R.id.button_findmode);
        id_box = (EditText)findViewById(R.id.text_id);
        text_idshow = (TextView)findViewById(R.id.id_show);
        btnmsg_sh = (TextView)findViewById(R.id.text_share);
        btnmsg_se = (TextView)findViewById(R.id.text_search);
        error_message = (TextView)findViewById(R.id.error_msg);
        app = (MeePaApp) this.getApplication();

        app.loadUserInfo();
        user_name = app.getSelfUserName();
        myID = app.getSelfUserId();
        id_box.setText(user_name, TextView.BufferType.NORMAL);
        text_idshow.setText(myID);

        //フォント設定
        btn_issue.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
        id_box.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
        text_idshow.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
        hidebtn_reset.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
        btnmsg_sh.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
        btnmsg_se.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );
        error_message.setTypeface( Typeface.createFromAsset( getAssets(), "FLOPDesignFont.ttf" ), Typeface.NORMAL );

        hidebtn_reset.setAllCaps(false);
        hidebtn_reset.setText("Your Name");
        error_message.setGravity(Gravity.CENTER);



        //各ボタンのClickListenerの宣言
        btn_issue.setOnClickListener(issListener);
        hidebtn_reset.setOnClickListener(hideListener);
        btn_share.setOnClickListener(shaListener);
        btn_findmode.setOnClickListener(findListener);


        // ボタンの幅,高さが決定してから幅=高さに揃える
        // ViewTreeObserverを利用
        // 參考 : http://tech.admax.ninja/2014/09/17/how-to-get-the-height-and-width-of-the-view/
        //        https://anz-note.tumblr.com/post/96096731156/androidで動的に縦幅あるいは橫幅に合わせて正方形のviewを作成したい
        final ViewTreeObserver observer = btn_share.getViewTreeObserver();
        observer.addOnGlobalLayoutListener(
                new ViewTreeObserver.OnGlobalLayoutListener() {
                    @Override
                    public void onGlobalLayout() {
                        // ボタンの幅=高さにする
//                        Log.d("btn", btn_share.getWidth() + ", " + btn_share.getHeight());
                        ViewGroup.LayoutParams params = btn_share.getLayoutParams();
                        // 短辺の長さに長辺を揃える
                        if (btn_share.getWidth() < btn_share.getHeight())
                            params.height = btn_share.getWidth();
                        else params.width = btn_share.getHeight();

                        // 位置調整用に幅・高さの差をとる
                        int diff = btn_share.getHeight() - btn_share.getWidth();

                        btn_share.setLayoutParams( params );
                        btn_findmode.setLayoutParams( params );

                        // 表示位置を調整
                        if ( diff > 0 ) { // 高さを幅に合わせた(縦幅が縮んだ)場合Y座標を調整
                            btn_share.setTranslationY( diff/2 );
                            btn_findmode.setTranslationY( diff/2 );
                        } else { // 幅に高さを合わせた(橫幅が縮んだ)場合X座標を調整
                            btn_share.setTranslationX( -diff/2 );
                            btn_findmode.setTranslationX( -diff/2 );
                        }

                        removeOnGlobalLayoutListener(btn_share.getViewTreeObserver(), this);
                    }
                });
    }
 
開發者ID:jphacks,項目名稱:TK_1701,代碼行數:81,代碼來源:RegActivity.java

示例8: onCreate

import android.widget.Button; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialogbaneer);
        final String s1 = getIntent().getExtras().getString("s1");
        final String s2 = getIntent().getExtras().getString("s2");
        final String s3 = getIntent().getExtras().getString("s3");
        final String s4 = getIntent().getExtras().getString("s4");
        final String s5 = getIntent().getExtras().getString("s5");
        //Initialize ImageView
        ImageView imageView = (ImageView) findViewById(R.id.imageViewc);

//Loading image from below url into imageView

        Picasso.with(this)
                .load(s5)
                .into(imageView);
        //String s5 = getIntent().getExtras().getString("s5");
        //String s6 = getIntent().getExtras().getString("s6");

        findViewById(R.id.buttonc).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent DirectLaunchIntent = new Intent(Intent.ACTION_VIEW  , Uri.parse(s3));
                if (s4.equals("0")){
                    DirectLaunchIntent.setPackage("com.farsitel.bazaar");
                }
                DirectLaunchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
                DirectLaunchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(DirectLaunchIntent);
                finish();
                }
        });
        TextView t = (TextView) findViewById(R.id.textViewc);
        Button t2 = (Button) findViewById(R.id.buttonc);
        Typeface persianTypeface = Typeface.createFromAsset(getAssets(), "fonts/ir.ttf");

        t2.setTypeface(persianTypeface);
        t.setText(s1);
        t2.setText(s2);
        System.out.println(s1);
    }
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:43,代碼來源:Dialog.java

示例9: initializeComponents

import android.widget.Button; //導入方法依賴的package包/類
void initializeComponents()
{
    shareProfile = (Button)findViewById(R.id.share_btn);
    repoLayout = (RelativeLayout)findViewById(R.id.repo_layout);

    nameText = (TextView)findViewById(R.id.name);
    usernameText = (TextView)findViewById(R.id.username);

    followersText = (TextView)findViewById(R.id.followers_num);
    followersText2 = (TextView)findViewById(R.id.followers_text);
    followingText = (TextView)findViewById(R.id.following_num);
    followingText2 = (TextView)findViewById(R.id.following_text);
    repoText = (TextView)findViewById(R.id.repo_num);
    repoText2 = (TextView)findViewById(R.id.repo_text);

    githubUrl = (TextView)findViewById(R.id.github_url);
    recentRepoText = (TextView)findViewById(R.id.repo_update_text);

    topRepoText = (TextView)findViewById(R.id.top_repo_text);
    topRepoText1 = (TextView)findViewById(R.id.top_repo_text2);

    refreshText = (TextView)findViewById(R.id.tap_get_btn);

    backgroundImage = (ImageView)findViewById(R.id.cover_image);
    profileImage = (CircularImageView)findViewById(R.id.profile_image);

    //Setting the typefaces
    shareProfile.setTypeface(typeface);

    nameText.setTypeface(typefaceBold);
    usernameText.setTypeface(typeface);

    followingText.setTypeface(typeface);
    followingText2.setTypeface(typeface);
    followersText.setTypeface(typeface);
    followersText2.setTypeface(typeface);
    repoText.setTypeface(typeface);
    repoText2.setTypeface(typeface);

    githubUrl.setTypeface(typeface);
    recentRepoText.setTypeface(typeface);
    topRepoText.setTypeface(typefaceBold);
    topRepoText1.setTypeface(typeface);

    refreshText.setTypeface(typeface);
}
 
開發者ID:twisstosin,項目名稱:Lasgithub-Android,代碼行數:47,代碼來源:ProfileActivity.java

示例10: findViewids

import android.widget.Button; //導入方法依賴的package包/類
private void findViewids() {
	txtApp = (TextView) findViewById(R.id.txtAppName);
	txtApp.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_android));
	layBack = (RelativeLayout)findViewById(R.id.layBack);
	imagePhoto = (CircleImageView)findViewById(R.id.imgProfilePicSet);
	txtName = (TextView)findViewById(R.id.txtName);
	txtName.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtUserName = (TextView)findViewById(R.id.txtUserName);
	txtUserName.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtEmail = (TextView)findViewById(R.id.txtEmail);
	txtEmail.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	imgEmail = (ImageView)findViewById(R.id.imgEmail);
	layEmail = (LinearLayout)findViewById(R.id.layEmail);
	txtMobile = (TextView)findViewById(R.id.txtMobile);
	txtMobile.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	imgMobCall = (ImageView)findViewById(R.id.imgCallMob);
	layMob   = (LinearLayout)findViewById(R.id.layMob);		
	txtAlternateNumber = (TextView)findViewById(R.id.txtAlternateMobile);
	txtBloodGroup = (TextView)findViewById(R.id.txtBloodGroup);
	txtAlternateNumber.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtBloodGroup.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	imgAltCall   = (ImageView)findViewById(R.id.imgCallAlt);
	layAlt       = (LinearLayout)findViewById(R.id.layAltMob);
	txtProfession = (TextView)findViewById(R.id.txtProfession);
	txtProfession.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtAddress = (TextView)findViewById(R.id.txtAddress);
	txtAddress.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtCity = (TextView)findViewById(R.id.txtCity);
	txtCity.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtCountry = (TextView)findViewById(R.id.txtCountry);
	txtCountry.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtCompany = (TextView)findViewById(R.id.txtCompany);
	txtCompany.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtMakeAdmin = (Button) findViewById(R.id.txtMadeAdmin);
	txtMakeAdmin.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtUserStatus = (TextView)findViewById(R.id.txtUserStatus);
	txtUserStatus.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	imgSave  = (ImageView)findViewById(R.id.imgSave);
	relProgress = (RelativeLayout)findViewById(R.id.layProgressresult);
	relInternet = (RelativeLayout)findViewById(R.id.layinternetresult);
	relNetwork = (RelativeLayout)findViewById(R.id.layNoresultserver);
	txtInternet = (TextView)findViewById(R.id.txtnoinertnettestresult);
	txtInternet.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	txtnetwork = (TextView)findViewById(R.id.txtNoresultnetwork);
	txtnetwork.setTypeface(ManagerTypeface.getTypeface(GroupUserProfile.this, R.string.typeface_roboto_regular));
	scrollMain = (ScrollView)findViewById(R.id.laymain);
	imgDelete   = (ImageView)findViewById(R.id.imgDelete);
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:49,代碼來源:GroupUserProfile.java

示例11: getView

import android.widget.Button; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    Project project = mProjects.get(position);
    if(convertView == null) {
        LayoutInflater inflater = LayoutInflater.from(MBApp.getApp());
        convertView = inflater.inflate(R.layout.project_items, null);
    }

    Button appNameButton = (Button) convertView.findViewById(R.id.appNameButton);
    appNameButton.setTypeface(MBApp.getApp().getRobotoTypeface());

    ExtendedEditText appNameEdit = (ExtendedEditText) convertView.findViewById(R.id.appNameEdit);
    appNameEdit.setTypeface(MBApp.getApp().getRobotoTypeface());

    LinearLayout actionBarLayout = (LinearLayout) convertView.findViewById(R.id.actionBarForProgram);
    if(actionBarLayout != null) {
        if(project.actionBarExpanded) {
            actionBarLayout.setVisibility(View.VISIBLE);
            appNameButton.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(MBApp.getApp()
                    , R.drawable.ic_arrow_down), null);
        } else {
            actionBarLayout.setVisibility(View.GONE);
            appNameButton.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(MBApp.getApp()
                    , R.drawable.ic_arrow_left), null);
        }
    }

    appNameButton.setText(project.name);
    appNameButton.setTag(R.id.positionId, position);
    appNameButton.setTag(R.id.textEdit, appNameEdit);
    appNameButton.setOnClickListener(appNameClickListener);
    appNameButton.setOnLongClickListener(appNameLongClickListener);

    appNameEdit.setTag(R.id.positionId, position);
    appNameEdit.setTag(R.id.editbutton, appNameButton);
    appNameEdit.setOnEditorActionListener(editorOnActionListener);
    appNameEdit.setFilters(new InputFilter[]{renameFilter});

    if(project.inEditMode) {
        appNameEdit.setVisibility(View.VISIBLE);

        appNameEdit.setText(project.name);
        appNameEdit.setSelection(project.name.length());
        appNameEdit.requestFocus();
        appNameButton.setVisibility(View.INVISIBLE);

    } else {
        appNameEdit.setVisibility(View.INVISIBLE);
        appNameButton.setVisibility(View.VISIBLE);
        //dismissKeyBoard(appNameEdit, false);
    }

    //appNameEdit.setOnClickListener(appNameClickListener);

    TextView flashBtnText = (TextView) convertView.findViewById(R.id.project_item_text);
    flashBtnText.setTypeface(MBApp.getApp().getRobotoTypeface());
    LinearLayout sendBtnLayout = (LinearLayout) convertView.findViewById(R.id.sendBtn);
    sendBtnLayout.setTag(position);
    sendBtnLayout.setOnClickListener(sendBtnClickListener);

    ImageButton deleteBtn = (ImageButton) convertView.findViewById(R.id.deleteBtn);
    deleteBtn.setTag(position);
    deleteBtn.setOnClickListener(deleteBtnClickListener);
    deleteBtn.setEnabled(true);


    Drawable myIcon;
    if(project.runStatus) {
        flashBtnText.setText("");
        myIcon = convertView.getResources().getDrawable(R.drawable.green_btn);
    } else {
        flashBtnText.setText(R.string.flash);
        myIcon = convertView.getResources().getDrawable(R.drawable.blue_btn);
    }
    sendBtnLayout.setBackground(myIcon);

    sendBtnLayout.setClickable(true);
    return convertView;
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:81,代碼來源:ProjectAdapter.java

示例12: setupFontStyle

import android.widget.Button; //導入方法依賴的package包/類
/**
 * Setup font styles by setting an appropriate typefaces.
 */
private void setupFontStyle() {
    ImageView ohPrettyImg = (ImageView) findViewById(R.id.oh_pretty_emoji);
    ohPrettyImg.setVisibility(View.INVISIBLE);

    MBApp application = MBApp.getApp();

    Typeface defaultTypeface = application.getTypeface();

    deviceConnectionStatusBtn.setTypeface(defaultTypeface);
    // Connect Screen
    TextView appBarTitle = (TextView) findViewById(R.id.flash_projects_title_txt);
    appBarTitle.setTypeface(defaultTypeface);

    TextView pairBtnText = (TextView) findViewById(R.id.custom_pair_button_text);
    pairBtnText.setTypeface(defaultTypeface);

    Typeface boldTypeface = application.getTypefaceBold();

    TextView manageMicrobit = (TextView) findViewById(R.id.title_manage_microbit);
    manageMicrobit.setTypeface(boldTypeface);

    TextView manageMicorbitStatus = (TextView) findViewById(R.id.device_status_txt);
    manageMicorbitStatus.setTypeface(boldTypeface);

    // How to pair your micro:bit - Screen #1
    TextView pairTipTitle = (TextView) findViewById(R.id.pairTipTitle);
    pairTipTitle.setTypeface(boldTypeface);

    TextView stepOneTitle = (TextView) findViewById(R.id.pair_tip_step_1_step);
    stepOneTitle.setTypeface(boldTypeface);

    // Step 2 - Enter Pattern
    TextView enterPatternTitle = (TextView) findViewById(R.id.enter_pattern_step_2_title);
    enterPatternTitle.setTypeface(boldTypeface);

    TextView stepTwoTitle = (TextView) findViewById(R.id.pair_enter_pattern_step_2);
    stepTwoTitle.setTypeface(boldTypeface);


    // Step 3 - Searching for micro:bit
    TextView searchMicrobitTitle = (TextView) findViewById(R.id.search_microbit_step_3_title);
    searchMicrobitTitle.setTypeface(boldTypeface);

    TextView stepThreeTitle = (TextView) findViewById(R.id.searching_microbit_step);
    stepThreeTitle.setTypeface(boldTypeface);

    Typeface robotoTypeface = application.getRobotoTypeface();

    TextView descriptionManageMicrobit = (TextView) findViewById(R.id.description_manage_microbit);
    descriptionManageMicrobit.setTypeface(robotoTypeface);

    TextView problemsMicrobit = (TextView) findViewById(R.id.connect_microbit_problems_message);
    problemsMicrobit.setTypeface(robotoTypeface);

    TextView stepOneInstructions = (TextView) findViewById(R.id.pair_tip_step_1_instructions);
    stepOneInstructions.setTypeface(robotoTypeface);

    Button cancelPairButton = (Button) findViewById(R.id.cancel_tip_step_1_btn);
    cancelPairButton.setTypeface(robotoTypeface);

    Button nextPairButton = (Button) findViewById(R.id.ok_tip_step_1_btn);
    nextPairButton.setTypeface(robotoTypeface);

    TextView stepTwoInstructions = (TextView) findViewById(R.id.pair_enter_pattern_step_2_instructions);
    stepTwoInstructions.setTypeface(robotoTypeface);

    Button cancelEnterPattern = (Button) findViewById(R.id.cancel_enter_pattern_step_2_btn);
    cancelEnterPattern.setTypeface(robotoTypeface);

    Button okEnterPatternButton = (Button) findViewById(R.id.ok_enter_pattern_step_2_btn);
    okEnterPatternButton.setTypeface(robotoTypeface);

    TextView stepThreeInstructions = (TextView) findViewById(R.id.searching_microbit_step_instructions);
    stepThreeInstructions.setTypeface(robotoTypeface);

    Button cancelSearchMicroBit = (Button) findViewById(R.id.cancel_search_microbit_step_3_btn);
    cancelSearchMicroBit.setTypeface(robotoTypeface);
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:82,代碼來源:PairingActivity.java

示例13: onCreateView

import android.widget.Button; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.fragment_album_layout, container, false);
    mContext = getContext();
    setHasOptionsMenu(true);
    mApp = (Common) mContext.getApplicationContext();

    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    mFastScroller = (FastScroller) view.findViewById(R.id.fast_scroller);
    TextView emptyText = (TextView) view.findViewById(R.id.empty_text_view);
    mCreatePlaylistButton = (Button) view.findViewById(R.id.create_playlist);
    mEmptyStateLayout = (RelativeLayout) view.findViewById(R.id.empty_state);


    mCreatePlaylistButton.setTypeface(TypefaceHelper.getTypeface(mContext, TypefaceHelper.FUTURA_BOLD));
    emptyText.setTypeface(TypefaceHelper.getTypeface(mContext, TypefaceHelper.FUTURA_BOLD));

    mCreatePlaylistButton.setOnClickListener(v -> {
        PlaylistDialog playlistDialog = new PlaylistDialog();
        playlistDialog.show(getActivity().getSupportFragmentManager(), "FRAGMENT_TAG");
    });


    mFastScroller.setRecyclerView(mRecyclerView);
    mAdapter = new PlaylistAdapter(this);
    mRecyclerView.setAdapter(mAdapter);

    mRecyclerView.addOnScrollListener(new HidingScrollListener() {
        @Override
        public void onHide() {
            mOnScrolledListener.onScrolledUp();
        }

        @Override
        public void onShow() {
            mOnScrolledListener.onScrolledDown();
        }

    });

    return view;
}
 
開發者ID:reyanshmishra,項目名稱:Rey-MusicPlayer,代碼行數:45,代碼來源:PlaylistFragment.java

示例14: setUpViews

import android.widget.Button; //導入方法依賴的package包/類
private void setUpViews(View view) {
    txtBimestre1 = (TextView) view.findViewById(R.id.textbimestre1);
    txtBimestre2 = (TextView) view.findViewById(R.id.textbimestre2);
    txtProvaFinal = (TextView) view.findViewById(R.id.textprovaf);
    btCalcular = (Button) view.findViewById(R.id.btcalcular);
    edtBimestre1 = (EditText) view.findViewById(R.id.bimestre1);
    edtBimestre2 = (EditText) view.findViewById(R.id.bimestre2);
    edtProvaFinal = (EditText) view.findViewById(R.id.provafinal);
    situacaoStatus  = (TextView) view.findViewById(R.id.situaresult);
    txtMensagem  = (TextView) view.findViewById(R.id.textprecisa);
    txtResultado  = (TextView) view.findViewById(R.id.resultadotext);
    txtMedia  = (TextView) view.findViewById(R.id.media);
    txtNota  = (TextView) view.findViewById(R.id.textNota);

    resultShow = (LinearLayout) view.findViewById(R.id.resultShow);

    //set font in views
    txtBimestre1.setTypeface(pfBeausans);
    txtBimestre2.setTypeface(pfBeausans);
    txtProvaFinal.setTypeface(pfBeausans);
    btCalcular.setTypeface(pfBeausans);
    edtBimestre1.setTypeface(pfBeausans);
    edtBimestre2.setTypeface(pfBeausans);
    edtProvaFinal.setTypeface(pfBeausans);

    situacaoStatus.setTypeface(pfBeausans);
    txtMensagem.setTypeface(pfBeausans);
    txtResultado.setTypeface(pfBeausans);
    txtMedia.setTypeface(pfBeausans);
    txtNota.setTypeface(pfBeausans);

    if (zeroAcem)
        txtNota.setText(getString(R.string.nota100));
    else
        txtNota.setText(getString(R.string.nota10));


    //set onClick Buttons
    btCalcular.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            calculaNotas(v);
        }
    });
}
 
開發者ID:caiovidaln,項目名稱:ifcalc,代碼行數:45,代碼來源:CalculatorSemestralFragment.java

示例15: setUpViews

import android.widget.Button; //導入方法依賴的package包/類
private void setUpViews(View view) {
    txtBimestre1 = (TextView) view.findViewById(R.id.textbimestre1);
    txtBimestre2 = (TextView) view.findViewById(R.id.textbimestre2);
    txtBimestre3 = (TextView) view.findViewById(R.id.textbimestre3);
    txtBimestre4 = (TextView) view.findViewById(R.id.textbimestre4);
    txtProvaFinal = (TextView) view.findViewById(R.id.textprovaf);
    btCalcular = (Button) view.findViewById(R.id.btcalcular);
    edtBimestre1 = (EditText) view.findViewById(R.id.bimestre1);
    edtBimestre2 = (EditText) view.findViewById(R.id.bimestre2);
    edtBimestre3 = (EditText) view.findViewById(R.id.bimestre3);
    edtBimestre4 = (EditText) view.findViewById(R.id.bimestre4);
    edtProvaFinal = (EditText) view.findViewById(R.id.provafinal);
    situacaoStatus  = (TextView) view.findViewById(R.id.situaresult);
    txtMensagem  = (TextView) view.findViewById(R.id.textprecisa);
    txtResultado  = (TextView) view.findViewById(R.id.resultadotext);
    txtMedia  = (TextView) view.findViewById(R.id.media);
    txtNota  = (TextView) view.findViewById(R.id.textNota);

    resultShow = (LinearLayout) view.findViewById(R.id.resultShow);

    //set font in views
    txtBimestre1.setTypeface(pfBeausans);
    txtBimestre2.setTypeface(pfBeausans);
    txtBimestre3.setTypeface(pfBeausans);
    txtBimestre4.setTypeface(pfBeausans);
    txtProvaFinal.setTypeface(pfBeausans);
    btCalcular.setTypeface(pfBeausans);
    edtBimestre1.setTypeface(pfBeausans);
    edtBimestre2.setTypeface(pfBeausans);
    edtBimestre3.setTypeface(pfBeausans);
    edtBimestre4.setTypeface(pfBeausans);
    edtProvaFinal.setTypeface(pfBeausans);

    situacaoStatus.setTypeface(pfBeausans);
    txtMensagem.setTypeface(pfBeausans);
    txtResultado.setTypeface(pfBeausans);
    txtMedia.setTypeface(pfBeausans);
    txtNota.setTypeface(pfBeausans);

    if (zeroAcem)
        txtNota.setText(getString(R.string.nota100));
    else
        txtNota.setText(getString(R.string.nota10));


    //set onClick Buttons
    btCalcular.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            calculaNotas(v);
        }
    });
}
 
開發者ID:caiovidaln,項目名稱:ifcalc,代碼行數:53,代碼來源:CalculatorAnualFragment.java


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