• Как проверить равенство background у ImageView с картинкой из drawable?

    En1q0d
    @En1q0d Автор вопроса
    <?xml version="1.0" encoding="utf-8"?>
    <android.support.percent.PercentRelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/bgforobject"
        tools:context="samsung.ru.spacex.InfRocket">
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="30%"
            app:layout_heightPercent="10%"
            app:layout_marginTopPercent="3%"
            app:layout_marginLeftPercent="28.9%"
            android:background="@drawable/rocket_name1"
            android:id="@+id/imageViewNameRocket_1"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
          />
    
            <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="10%"
            app:layout_heightPercent="70%"
            app:layout_marginBottomPercent="10.8%"
            app:layout_marginLeftPercent="28.9%"
            android:background="@drawable/rocket_2"
            android:id="@+id/imageViewInfRocket"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="20%"
            app:layout_heightPercent="10%"
            app:layout_marginTopPercent="20%"
            app:layout_marginRightPercent="28.9%"
            android:background="@drawable/speed"
            android:id="@+id/imageViewSpeed"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="25%"
            app:layout_heightPercent="20%"
            app:layout_marginTopPercent="14.5%"
            app:layout_marginRightPercent="10%"
            android:background="@drawable/counts3"
            android:id="@+id/imageViewCounts3"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="24%"
            app:layout_heightPercent="10%"
            app:layout_marginTopPercent="32%"
            app:layout_marginRightPercent="28.9%"
            android:background="@drawable/strength"
            android:id="@+id/imageViewStrength"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="25%"
            app:layout_heightPercent="20%"
            app:layout_marginTopPercent="26.5%"
            app:layout_marginRightPercent="10%"
            android:background="@drawable/counts2"
            android:id="@+id/imageViewCounts2"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="24%"
            app:layout_heightPercent="10%"
            app:layout_marginTopPercent="44%"
            app:layout_marginRightPercent="28.9%"
            android:background="@drawable/mobility"
            android:id="@+id/imageViewMobility"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="25%"
            app:layout_heightPercent="20%"
            app:layout_marginTopPercent="38.5%"
            app:layout_marginRightPercent="10%"
            android:background="@drawable/counts2"
            android:id="@+id/imageViewCounts22"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="24%"
            app:layout_heightPercent="10%"
            app:layout_marginTopPercent="56%"
            app:layout_marginRightPercent="28.9%"
            android:background="@drawable/capacity"
            android:id="@+id/imageViewCapacity"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="25%"
            app:layout_heightPercent="20%"
            app:layout_marginTopPercent="50.5%"
            app:layout_marginRightPercent="10%"
            android:background="@drawable/counts4"
            android:id="@+id/imageViewCounts4"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />
    
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="16%"
            app:layout_heightPercent="9%"
            app:layout_marginRightPercent="17%"
            app:layout_marginBottomPercent="19%"
            android:id="@+id/imageButtonBuyRocket"
            android:background="@drawable/buy"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentBottom="true" />
    
    
    </android.support.percent.PercentRelativeLayout>
    Ответ написан
    Комментировать
  • Как задать точно расположение ImageView?

    En1q0d
    @En1q0d Автор вопроса
    <?xml version="1.0" encoding="utf-8"?>
    <android.support.percent.PercentRelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:background="@drawable/hangar"
        tools:context="samsung.ru.spacex.Hangar">
    
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_widthPercent="12%"
            app:layout_heightPercent="70%"
            app:layout_marginLeftPercent="8%"
            app:layout_marginBottomPercent="6%"
            android:background="@drawable/rocket_1"
            android:id="@+id/imageButton5"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
    
            />
    Ответ написан
    Комментировать