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

                              Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

                              Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

                              How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page