SORU
29 Aralık 2013, Pazar


Picasso ile tam sabit genişlik ve yükseklik yeniden boyutlandırmak için görüntü

Öğeleri ImageView yüklü kullanarak bir Picasso bulunduğu dikey bir LinearLayout var. Tam cihaz genişliği görüntü genişliği yükselmeye ve görüntüyü sabit bir yükseklik kırpılmış (150dp) merkezi kısmını görüntülemek istiyorum. Ben şu anda aşağıdaki kodu var:

Picasso.with(getActivity()) 
    .load(imageUrl) 
    .placeholder(R.drawable.placeholder) 
    .error(R.drawable.error) 
    .resize(screenWidth, imageHeight)
    .centerInside() 
    .into(imageView);

Hangi değerler screenWidth imageHeight (=150dp) içine koymalıyım?

CEVAP
20 ŞUBAT 2013, ÇARŞAMBA


Bunun temelleri aşağı almak için bir yol olarak Javascript ile video poker oyunu yazma girişiminde bulunuyorum ve jQuery tıklayın işleyicileri ateş birden çok kez olay nerede bir sorun haline koşuyoruz.

Onlar ekli düğmeleri yerleştirmek için bir bahis ve ince işleri için yerleştirme bahis ilk el sırasında bir oyun (ateş yalnızca bir kez); ama bahis için ikinci el, yangınlar click olayı iki kez, her zaman bir bahis veya bahis düğmesini basılı tutun (yani iki kez doğru miktarda bahis için her basın). Genel olarak, click olayı bahis bir düğme nerede ... bir kere basıldığında tetiklenir sayısı için bu izlergel ..dizinin terim bu bahis içingel ..el başında oyun: 1, 2, 4, 7, 11, 16, 22, 29, 37, 46, hangi taksicinin n(n 1)/2 1 için ne olursa olsun bunun değerini ben değildim, yeterince akıllı olduğunu düşünüp, kullandım OEIS. :)

Burada yukarı hareket edilir tıklatın olay işleyicileri ile işlevi; umarım kolay anlamak için (eğer değilse, bu işte daha iyi olsun istiyorum beni de haberdar):

/** The following function keeps track of bet buttons that are pressed, until place button is pressed to place bet. **/
function pushingBetButtons() {
    $("#money").text("Money left: $"   player.money); // displays money player has left

    $(".bet").click(function() {
        var amount = 0; // holds the amount of money the player bet on this click
        if($(this).attr("id") == "bet1") { // the player just bet $1
            amount = 1;
        } else if($(this).attr("id") == "bet5") { // etc.
            amount = 5;
        } else if($(this).attr("id") == "bet25") {
            amount = 25;
        } else if($(this).attr("id") == "bet100") {
            amount = 100;
        } else if($(this).attr("id") == "bet500") {
            amount = 500;
        } else if($(this).attr("id") == "bet1000") {
            amount = 1000;
        }
        if(player.money >= amount) { // check whether the player has this much to bet
            player.bet  = amount; // add what was just bet by clicking that button to the total bet on this hand
            player.money -= amount; // and, of course, subtract it from player's current pot
            $("#money").text("Money left: $"   player.money); // then redisplay what the player has left
        } else {
            alert("You don't have $"   amount   " to bet.");
        }
    });

    $("#place").click(function() {
        if(player.bet == 0) { // player didn't bet anything on this hand
            alert("Please place a bet first.");
        } else {
            $("#card_para").css("display", "block"); // now show the cards
            $(".card").bind("click", cardClicked); // and set up the event handler for the cards
            $("#bet_buttons_para").css("display", "none"); // hide the bet buttons and place bet button
            $("#redraw").css("display", "block"); // and reshow the button for redrawing the hand
            player.bet = 0; // reset the bet for betting on the next hand
            drawNewHand(); // draw the cards
        }
    });
}

Lütfen bana bildirin varsa herhangi bir fikir veya öneri veya çözüm için benim sorunum benzer bir çözüm için bir başka sorun burada (baktım çok benzer başlıklı konuları ve hiç şans bulmak bir çözüm olabilir benim için).

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • LavcoPriceTech

    LavcoPriceTe

    21 AĞUSTOS 2010
  • My Name Is Jeff

    My Name Is J

    26 ŞUBAT 2008
  • bored before i even began

    bored before

    30 Mart 2009