How to resize icon automatically upon adding new icon? The Next CEO of Stack OverflowHow do save an Android Activity state using save instance state?How do I center text horizontally and vertically in a TextView?Why is the Android emulator so slow? How can we speed up the Android emulator?Is quitting an application frowned upon?How to get the absolute coordinates of a viewHow to align views at the bottom of the screen?How to hide the title bar for an Activity in XML with existing custom themeHow Do You Parse and Process HTML/XML in PHP?How do I fix android.os.NetworkOnMainThreadException?Mipmap drawables for icons

Calculator final project in Python

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

Is the D&D universe the same as the Forgotten Realms universe?

Is it convenient to ask the journal's editor for two additional days to complete a review?

Is there a way to save my career from absolute disaster?

Won the lottery - how do I keep the money?

Is wanting to ask what to write an indication that you need to change your story?

Why the difference in type-inference over the as-pattern in two similar function definitions?

How did people program for Consoles with multiple CPUs?

Why do airplanes bank sharply to the right after air-to-air refueling?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

A small doubt about the dominated convergence theorem

WOW air has ceased operation, can I get my tickets refunded?

How to count occurrences of text in a file?

Are police here, aren't itthey?

RigExpert AA-35 - Interpreting The Information

Which one is the true statement?

Chain wire methods together in Lightning Web Components

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

Why does the flight controls check come before arming the autobrake on the A320?

A Man With a Stainless Steel Endoskeleton (like The Terminator) Fighting Cloaked Aliens Only He Can See

Is French Guiana a (hard) EU border?

Legal workarounds for testamentary trust perceived as unfair



How to resize icon automatically upon adding new icon?



The Next CEO of Stack OverflowHow do save an Android Activity state using save instance state?How do I center text horizontally and vertically in a TextView?Why is the Android emulator so slow? How can we speed up the Android emulator?Is quitting an application frowned upon?How to get the absolute coordinates of a viewHow to align views at the bottom of the screen?How to hide the title bar for an Activity in XML with existing custom themeHow Do You Parse and Process HTML/XML in PHP?How do I fix android.os.NetworkOnMainThreadException?Mipmap drawables for icons










0















I want your help regarding a problem.
I am creating an app, and I have like 9 images which I want to appear horizontally across the screen.
Check this image



But in the above screenshot, as you can see, I have only 8 images and the screen seems to be full, I want to add one more image of number 9.
Here is my activity_main.xml (hastebin link)



It will be more helpful if you could explain to me a bit rather than just fixing it, also, could you please suggest other fixes, this is the college project I am working on.
Thank you for your precious time :)










share|improve this question




























    0















    I want your help regarding a problem.
    I am creating an app, and I have like 9 images which I want to appear horizontally across the screen.
    Check this image



    But in the above screenshot, as you can see, I have only 8 images and the screen seems to be full, I want to add one more image of number 9.
    Here is my activity_main.xml (hastebin link)



    It will be more helpful if you could explain to me a bit rather than just fixing it, also, could you please suggest other fixes, this is the college project I am working on.
    Thank you for your precious time :)










    share|improve this question


























      0












      0








      0








      I want your help regarding a problem.
      I am creating an app, and I have like 9 images which I want to appear horizontally across the screen.
      Check this image



      But in the above screenshot, as you can see, I have only 8 images and the screen seems to be full, I want to add one more image of number 9.
      Here is my activity_main.xml (hastebin link)



      It will be more helpful if you could explain to me a bit rather than just fixing it, also, could you please suggest other fixes, this is the college project I am working on.
      Thank you for your precious time :)










      share|improve this question
















      I want your help regarding a problem.
      I am creating an app, and I have like 9 images which I want to appear horizontally across the screen.
      Check this image



      But in the above screenshot, as you can see, I have only 8 images and the screen seems to be full, I want to add one more image of number 9.
      Here is my activity_main.xml (hastebin link)



      It will be more helpful if you could explain to me a bit rather than just fixing it, also, could you please suggest other fixes, this is the college project I am working on.
      Thank you for your precious time :)







      android xml android-layout






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 17:43









      VikaS

      1




      1










      asked Mar 8 at 16:21









      Vinay KharayatVinay Kharayat

      32




      32






















          2 Answers
          2






          active

          oldest

          votes


















          0














          add another attribute for ImageButton, use following code:



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

          <RelativeLayout
          android:layout_width="wrap_content"
          android:layout_height="200dp">

          <TextView
          android:id="@+id/scoreText"
          android:layout_width="55dp"
          android:layout_height="50dp"
          android:layout_alignParentTop="true"
          android:text="@string/myScore"
          android:textColor="@android:color/background_light"
          android:textSize="18sp" />

          </RelativeLayout>

          <LinearLayout
          android:layout_width="match_parent"
          android:layout_height="150dp">

          <ImageButton
          android:id="@+id/number1"
          android:layout_width="0dp"
          android:layout_height="50dp"
          android:layout_weight="1"
          android:maxWidth="10dp"
          android:maxHeight="10dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/image_one" />

          <ImageButton
          android:id="@+id/number2"
          android:layout_width="0dp"
          android:layout_height="50dp"
          android:layout_weight="1"
          android:maxWidth="10dp"
          android:maxHeight="10dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/image_two" />

          <ImageButton
          android:id="@+id/number3"
          android:layout_width="0dp"
          android:layout_height="50dp"
          android:layout_weight="1"
          android:maxWidth="10dp"
          android:maxHeight="10dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/image_three" />

          <ImageButton
          android:id="@+id/number4"
          android:layout_width="0dp"
          android:layout_height="50dp"
          android:layout_weight="1"
          android:maxWidth="10dp"
          android:maxHeight="10dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/image_four" />

          <ImageButton
          android:id="@+id/number5"
          android:layout_width="0dp"
          android:layout_height="50dp"
          android:layout_weight="1"
          android:maxWidth="10dp"
          android:maxHeight="10dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/image_five" />

          <ImageButton
          android:id="@+id/number6"
          android:layout_width="0dp"
          android:layout_height="50dp"
          android:layout_weight="1"
          android:maxWidth="10dp"
          android:maxHeight="10dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/image_six" />

          <ImageButton
          android:id="@+id/number7"
          android:layout_width="0dp"
          android:layout_height="50dp"
          android:layout_weight="1"
          android:maxWidth="10dp"
          android:maxHeight="10dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/image_seven" />

          <ImageButton
          android:id="@+id/number8"
          android:layout_width="0dp"
          android:layout_height="50dp"
          android:layout_weight="1"
          android:maxWidth="10dp"
          android:maxHeight="10dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/image_eight" />

          <ImageButton
          android:id="@+id/number9"
          android:layout_width="0dp"
          android:layout_height="50dp"
          android:layout_weight="1"
          android:maxWidth="10dp"
          android:maxHeight="10dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/image_nine" />
          </LinearLayout>

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

          <ImageView
          android:id="@+id/imageView"
          android:layout_width="220dp"
          android:layout_height="130dp"
          android:maxWidth="130dp"
          android:maxHeight="130dp"
          android:scaleType="fitCenter"
          app:srcCompat="@drawable/dice_6" />

          <ImageView
          android:id="@+id/imageView2"
          android:layout_width="wrap_content"
          android:layout_height="130dp"
          android:maxWidth="130dp"
          android:maxHeight="130dp"
          android:scaleType="fitCenter"
          android:layout_weight="1"
          app:srcCompat="@drawable/dice_6" />
          </LinearLayout>

          <RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content">

          <Button
          android:id="@+id/rollButton"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:layout_marginBottom="109dp"
          android:background="@color/colorAccent"
          android:gravity="center_vertical"
          android:text="@string/rollButton"
          android:textAlignment="center"
          android:textColorLink="@color/colorAccent" />
          </RelativeLayout>
          </LinearLayout>





          share|improve this answer






























            0














            If the images are fixed, you can set your LinearLayout width (the ones that contains the images) as "match_parent" and add the attribute weightSum = 9 . That will make its width the same as the container. Then you set each image width to 0 and add weight= 1.
            This will make each image width 1/9 of the parent, no matter the size of the device screen.



            It will look something like the answer of user9209780.






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55067127%2fhow-to-resize-icon-automatically-upon-adding-new-icon%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              add another attribute for ImageButton, use following code:



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

              <RelativeLayout
              android:layout_width="wrap_content"
              android:layout_height="200dp">

              <TextView
              android:id="@+id/scoreText"
              android:layout_width="55dp"
              android:layout_height="50dp"
              android:layout_alignParentTop="true"
              android:text="@string/myScore"
              android:textColor="@android:color/background_light"
              android:textSize="18sp" />

              </RelativeLayout>

              <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="150dp">

              <ImageButton
              android:id="@+id/number1"
              android:layout_width="0dp"
              android:layout_height="50dp"
              android:layout_weight="1"
              android:maxWidth="10dp"
              android:maxHeight="10dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/image_one" />

              <ImageButton
              android:id="@+id/number2"
              android:layout_width="0dp"
              android:layout_height="50dp"
              android:layout_weight="1"
              android:maxWidth="10dp"
              android:maxHeight="10dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/image_two" />

              <ImageButton
              android:id="@+id/number3"
              android:layout_width="0dp"
              android:layout_height="50dp"
              android:layout_weight="1"
              android:maxWidth="10dp"
              android:maxHeight="10dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/image_three" />

              <ImageButton
              android:id="@+id/number4"
              android:layout_width="0dp"
              android:layout_height="50dp"
              android:layout_weight="1"
              android:maxWidth="10dp"
              android:maxHeight="10dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/image_four" />

              <ImageButton
              android:id="@+id/number5"
              android:layout_width="0dp"
              android:layout_height="50dp"
              android:layout_weight="1"
              android:maxWidth="10dp"
              android:maxHeight="10dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/image_five" />

              <ImageButton
              android:id="@+id/number6"
              android:layout_width="0dp"
              android:layout_height="50dp"
              android:layout_weight="1"
              android:maxWidth="10dp"
              android:maxHeight="10dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/image_six" />

              <ImageButton
              android:id="@+id/number7"
              android:layout_width="0dp"
              android:layout_height="50dp"
              android:layout_weight="1"
              android:maxWidth="10dp"
              android:maxHeight="10dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/image_seven" />

              <ImageButton
              android:id="@+id/number8"
              android:layout_width="0dp"
              android:layout_height="50dp"
              android:layout_weight="1"
              android:maxWidth="10dp"
              android:maxHeight="10dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/image_eight" />

              <ImageButton
              android:id="@+id/number9"
              android:layout_width="0dp"
              android:layout_height="50dp"
              android:layout_weight="1"
              android:maxWidth="10dp"
              android:maxHeight="10dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/image_nine" />
              </LinearLayout>

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

              <ImageView
              android:id="@+id/imageView"
              android:layout_width="220dp"
              android:layout_height="130dp"
              android:maxWidth="130dp"
              android:maxHeight="130dp"
              android:scaleType="fitCenter"
              app:srcCompat="@drawable/dice_6" />

              <ImageView
              android:id="@+id/imageView2"
              android:layout_width="wrap_content"
              android:layout_height="130dp"
              android:maxWidth="130dp"
              android:maxHeight="130dp"
              android:scaleType="fitCenter"
              android:layout_weight="1"
              app:srcCompat="@drawable/dice_6" />
              </LinearLayout>

              <RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content">

              <Button
              android:id="@+id/rollButton"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerHorizontal="true"
              android:layout_centerVertical="true"
              android:layout_marginBottom="109dp"
              android:background="@color/colorAccent"
              android:gravity="center_vertical"
              android:text="@string/rollButton"
              android:textAlignment="center"
              android:textColorLink="@color/colorAccent" />
              </RelativeLayout>
              </LinearLayout>





              share|improve this answer



























                0














                add another attribute for ImageButton, use following code:



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

                <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="200dp">

                <TextView
                android:id="@+id/scoreText"
                android:layout_width="55dp"
                android:layout_height="50dp"
                android:layout_alignParentTop="true"
                android:text="@string/myScore"
                android:textColor="@android:color/background_light"
                android:textSize="18sp" />

                </RelativeLayout>

                <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="150dp">

                <ImageButton
                android:id="@+id/number1"
                android:layout_width="0dp"
                android:layout_height="50dp"
                android:layout_weight="1"
                android:maxWidth="10dp"
                android:maxHeight="10dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/image_one" />

                <ImageButton
                android:id="@+id/number2"
                android:layout_width="0dp"
                android:layout_height="50dp"
                android:layout_weight="1"
                android:maxWidth="10dp"
                android:maxHeight="10dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/image_two" />

                <ImageButton
                android:id="@+id/number3"
                android:layout_width="0dp"
                android:layout_height="50dp"
                android:layout_weight="1"
                android:maxWidth="10dp"
                android:maxHeight="10dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/image_three" />

                <ImageButton
                android:id="@+id/number4"
                android:layout_width="0dp"
                android:layout_height="50dp"
                android:layout_weight="1"
                android:maxWidth="10dp"
                android:maxHeight="10dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/image_four" />

                <ImageButton
                android:id="@+id/number5"
                android:layout_width="0dp"
                android:layout_height="50dp"
                android:layout_weight="1"
                android:maxWidth="10dp"
                android:maxHeight="10dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/image_five" />

                <ImageButton
                android:id="@+id/number6"
                android:layout_width="0dp"
                android:layout_height="50dp"
                android:layout_weight="1"
                android:maxWidth="10dp"
                android:maxHeight="10dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/image_six" />

                <ImageButton
                android:id="@+id/number7"
                android:layout_width="0dp"
                android:layout_height="50dp"
                android:layout_weight="1"
                android:maxWidth="10dp"
                android:maxHeight="10dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/image_seven" />

                <ImageButton
                android:id="@+id/number8"
                android:layout_width="0dp"
                android:layout_height="50dp"
                android:layout_weight="1"
                android:maxWidth="10dp"
                android:maxHeight="10dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/image_eight" />

                <ImageButton
                android:id="@+id/number9"
                android:layout_width="0dp"
                android:layout_height="50dp"
                android:layout_weight="1"
                android:maxWidth="10dp"
                android:maxHeight="10dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/image_nine" />
                </LinearLayout>

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

                <ImageView
                android:id="@+id/imageView"
                android:layout_width="220dp"
                android:layout_height="130dp"
                android:maxWidth="130dp"
                android:maxHeight="130dp"
                android:scaleType="fitCenter"
                app:srcCompat="@drawable/dice_6" />

                <ImageView
                android:id="@+id/imageView2"
                android:layout_width="wrap_content"
                android:layout_height="130dp"
                android:maxWidth="130dp"
                android:maxHeight="130dp"
                android:scaleType="fitCenter"
                android:layout_weight="1"
                app:srcCompat="@drawable/dice_6" />
                </LinearLayout>

                <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <Button
                android:id="@+id/rollButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:layout_marginBottom="109dp"
                android:background="@color/colorAccent"
                android:gravity="center_vertical"
                android:text="@string/rollButton"
                android:textAlignment="center"
                android:textColorLink="@color/colorAccent" />
                </RelativeLayout>
                </LinearLayout>





                share|improve this answer

























                  0












                  0








                  0







                  add another attribute for ImageButton, use following code:



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

                  <RelativeLayout
                  android:layout_width="wrap_content"
                  android:layout_height="200dp">

                  <TextView
                  android:id="@+id/scoreText"
                  android:layout_width="55dp"
                  android:layout_height="50dp"
                  android:layout_alignParentTop="true"
                  android:text="@string/myScore"
                  android:textColor="@android:color/background_light"
                  android:textSize="18sp" />

                  </RelativeLayout>

                  <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="150dp">

                  <ImageButton
                  android:id="@+id/number1"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_one" />

                  <ImageButton
                  android:id="@+id/number2"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_two" />

                  <ImageButton
                  android:id="@+id/number3"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_three" />

                  <ImageButton
                  android:id="@+id/number4"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_four" />

                  <ImageButton
                  android:id="@+id/number5"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_five" />

                  <ImageButton
                  android:id="@+id/number6"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_six" />

                  <ImageButton
                  android:id="@+id/number7"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_seven" />

                  <ImageButton
                  android:id="@+id/number8"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_eight" />

                  <ImageButton
                  android:id="@+id/number9"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_nine" />
                  </LinearLayout>

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

                  <ImageView
                  android:id="@+id/imageView"
                  android:layout_width="220dp"
                  android:layout_height="130dp"
                  android:maxWidth="130dp"
                  android:maxHeight="130dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/dice_6" />

                  <ImageView
                  android:id="@+id/imageView2"
                  android:layout_width="wrap_content"
                  android:layout_height="130dp"
                  android:maxWidth="130dp"
                  android:maxHeight="130dp"
                  android:scaleType="fitCenter"
                  android:layout_weight="1"
                  app:srcCompat="@drawable/dice_6" />
                  </LinearLayout>

                  <RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content">

                  <Button
                  android:id="@+id/rollButton"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerHorizontal="true"
                  android:layout_centerVertical="true"
                  android:layout_marginBottom="109dp"
                  android:background="@color/colorAccent"
                  android:gravity="center_vertical"
                  android:text="@string/rollButton"
                  android:textAlignment="center"
                  android:textColorLink="@color/colorAccent" />
                  </RelativeLayout>
                  </LinearLayout>





                  share|improve this answer













                  add another attribute for ImageButton, use following code:



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

                  <RelativeLayout
                  android:layout_width="wrap_content"
                  android:layout_height="200dp">

                  <TextView
                  android:id="@+id/scoreText"
                  android:layout_width="55dp"
                  android:layout_height="50dp"
                  android:layout_alignParentTop="true"
                  android:text="@string/myScore"
                  android:textColor="@android:color/background_light"
                  android:textSize="18sp" />

                  </RelativeLayout>

                  <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="150dp">

                  <ImageButton
                  android:id="@+id/number1"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_one" />

                  <ImageButton
                  android:id="@+id/number2"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_two" />

                  <ImageButton
                  android:id="@+id/number3"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_three" />

                  <ImageButton
                  android:id="@+id/number4"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_four" />

                  <ImageButton
                  android:id="@+id/number5"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_five" />

                  <ImageButton
                  android:id="@+id/number6"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_six" />

                  <ImageButton
                  android:id="@+id/number7"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_seven" />

                  <ImageButton
                  android:id="@+id/number8"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_eight" />

                  <ImageButton
                  android:id="@+id/number9"
                  android:layout_width="0dp"
                  android:layout_height="50dp"
                  android:layout_weight="1"
                  android:maxWidth="10dp"
                  android:maxHeight="10dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/image_nine" />
                  </LinearLayout>

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

                  <ImageView
                  android:id="@+id/imageView"
                  android:layout_width="220dp"
                  android:layout_height="130dp"
                  android:maxWidth="130dp"
                  android:maxHeight="130dp"
                  android:scaleType="fitCenter"
                  app:srcCompat="@drawable/dice_6" />

                  <ImageView
                  android:id="@+id/imageView2"
                  android:layout_width="wrap_content"
                  android:layout_height="130dp"
                  android:maxWidth="130dp"
                  android:maxHeight="130dp"
                  android:scaleType="fitCenter"
                  android:layout_weight="1"
                  app:srcCompat="@drawable/dice_6" />
                  </LinearLayout>

                  <RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content">

                  <Button
                  android:id="@+id/rollButton"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerHorizontal="true"
                  android:layout_centerVertical="true"
                  android:layout_marginBottom="109dp"
                  android:background="@color/colorAccent"
                  android:gravity="center_vertical"
                  android:text="@string/rollButton"
                  android:textAlignment="center"
                  android:textColorLink="@color/colorAccent" />
                  </RelativeLayout>
                  </LinearLayout>






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 8 at 16:42









                  user9209780user9209780

                  230514




                  230514























                      0














                      If the images are fixed, you can set your LinearLayout width (the ones that contains the images) as "match_parent" and add the attribute weightSum = 9 . That will make its width the same as the container. Then you set each image width to 0 and add weight= 1.
                      This will make each image width 1/9 of the parent, no matter the size of the device screen.



                      It will look something like the answer of user9209780.






                      share|improve this answer



























                        0














                        If the images are fixed, you can set your LinearLayout width (the ones that contains the images) as "match_parent" and add the attribute weightSum = 9 . That will make its width the same as the container. Then you set each image width to 0 and add weight= 1.
                        This will make each image width 1/9 of the parent, no matter the size of the device screen.



                        It will look something like the answer of user9209780.






                        share|improve this answer

























                          0












                          0








                          0







                          If the images are fixed, you can set your LinearLayout width (the ones that contains the images) as "match_parent" and add the attribute weightSum = 9 . That will make its width the same as the container. Then you set each image width to 0 and add weight= 1.
                          This will make each image width 1/9 of the parent, no matter the size of the device screen.



                          It will look something like the answer of user9209780.






                          share|improve this answer













                          If the images are fixed, you can set your LinearLayout width (the ones that contains the images) as "match_parent" and add the attribute weightSum = 9 . That will make its width the same as the container. Then you set each image width to 0 and add weight= 1.
                          This will make each image width 1/9 of the parent, no matter the size of the device screen.



                          It will look something like the answer of user9209780.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 8 at 16:46









                          Agustin PazosAgustin Pazos

                          515




                          515



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55067127%2fhow-to-resize-icon-automatically-upon-adding-new-icon%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

                              Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                              2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived