SORU
4 Mart 2012, Pazar


İmageView android XML layout=layout_height&; wrap_content" " ile doldurma üst ve alt vardır

Dikey bir LinearLayout bir İmageView ve birkaç diğer düzenleri ve görünümleri içeren var.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:contentDescription="@string/banner_alt"
        android:src="@drawable/banner_portrait" />

    <TextView
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/main_search"
      android:gravity="center"
      android:textStyle="bold" />

    <LinearLayout
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="wrap_content" >

      <Spinner
        android:id="@ id/search_city_spinner"
        android:layout_width="0px"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:prompt="@string/search_city_prompt"
        android:entries="@array/search_city_array" />

      <Spinner
        android:id="@ id/search_area_spinner"
        android:layout_width="0px"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:prompt="@string/search_area_prompt"
        android:entries="@array/search_area_array" />

    </LinearLayout>

    <LinearLayout
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="wrap_content" >

      <Spinner
        android:id="@ id/search_rooms_spinner"
        android:layout_width="0px"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:prompt="@string/search_rooms_prompt"
        android:entries="@array/search_rooms_array" />

      <Spinner
        android:id="@ id/search_min_spinner"
        android:layout_width="0px"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:prompt="@string/search_min_prompt"
        android:entries="@array/search_min_array" />

      <Spinner
        android:id="@ id/search_max_spinner"
        android:layout_width="0px"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:prompt="@string/search_max_prompt"
        android:entries="@array/search_max_array" />

    </LinearLayout>

    <Button
      android:id="@ id/saearch_button"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/search_button"
      android:onClick="searchButton" />

</LinearLayout>

Benim sorunum faaliyet görüntülendiğinde, İmageView üst ve alt kısmında bir dolgu vardır. İmageView (İmageView bir arka plan renk ayarı) olduğunu teyit ettim.

Görüntü 450x450px. El ile yüksekliği 450px ayarı istenilen etkiyi hiçbir doldurma) üretir ve 450dp ayarlamak wrap_content kullanarak aynı etkiyi yaratır.

Android resim (450px) ve dp ile aynı değeri, ama İmageView yükseklik ayarı yüksekliği alıyor gibi görünüyor.

Bunu düzeltmek için ne yapabilirim herhangi bir fikir? Farklı ekran yoğunlukları için farklı görüntüler sağlayan olacağım gibi mutlak değerleri kullanmak istemiyorum.

CEVAP
20 Mart 2012, Salı


Benzer özelliklere sahiptir bir sorun vardı ve İmageView android:adjustViewBounds="true" kullanarak çözüldü.

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:contentDescription="@string/banner_alt"
    android:src="@drawable/banner_portrait" />

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • BigBoyTV

    BigBoyTV

    25 EYLÜL 2013
  • ThreadBanger

    ThreadBanger

    2 Mart 2007
  • wolfys you tube

    wolfys you t

    22 Kasım 2006