how to place the text in the bottom center












0















how to place the text in the bottom center?



my implementation



 @Override
protected void onDraw(Canvas canvas) {

Paint strokePaint = new Paint();
strokePaint.setARGB(255, 0, 0, 0);
//strokePaint.setTextAlign(Paint.Align.CENTER);


strokePaint.setTextSize(20);
strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(5);

Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
//textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(20);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);

canvas.drawText("Some Text", 100, 100, strokePaint);
canvas.drawText("Some Text", 100, 100, textPaint);

}




<ImageView
android:id="@+id/myImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img_1" />

<vbright.usanin.salesRegion.Text.TextViewOutline
android:id="@+id/myImageViewText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/myImageView"
android:layout_alignLeft="@+id/myImageView"
android:layout_alignRight="@+id/myImageView"
android:layout_alignTop="@+id/myImageView" />




enter image description here










share|improve this question



























    0















    how to place the text in the bottom center?



    my implementation



     @Override
    protected void onDraw(Canvas canvas) {

    Paint strokePaint = new Paint();
    strokePaint.setARGB(255, 0, 0, 0);
    //strokePaint.setTextAlign(Paint.Align.CENTER);


    strokePaint.setTextSize(20);
    strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
    strokePaint.setStyle(Paint.Style.STROKE);
    strokePaint.setStrokeWidth(5);

    Paint textPaint = new Paint();
    textPaint.setARGB(255, 255, 255, 255);
    //textPaint.setTextAlign(Paint.Align.CENTER);
    textPaint.setTextSize(20);
    textPaint.setTypeface(Typeface.DEFAULT_BOLD);

    canvas.drawText("Some Text", 100, 100, strokePaint);
    canvas.drawText("Some Text", 100, 100, textPaint);

    }




    <ImageView
    android:id="@+id/myImageView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:src="@drawable/img_1" />

    <vbright.usanin.salesRegion.Text.TextViewOutline
    android:id="@+id/myImageViewText"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignBottom="@+id/myImageView"
    android:layout_alignLeft="@+id/myImageView"
    android:layout_alignRight="@+id/myImageView"
    android:layout_alignTop="@+id/myImageView" />




    enter image description here










    share|improve this question

























      0












      0








      0








      how to place the text in the bottom center?



      my implementation



       @Override
      protected void onDraw(Canvas canvas) {

      Paint strokePaint = new Paint();
      strokePaint.setARGB(255, 0, 0, 0);
      //strokePaint.setTextAlign(Paint.Align.CENTER);


      strokePaint.setTextSize(20);
      strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
      strokePaint.setStyle(Paint.Style.STROKE);
      strokePaint.setStrokeWidth(5);

      Paint textPaint = new Paint();
      textPaint.setARGB(255, 255, 255, 255);
      //textPaint.setTextAlign(Paint.Align.CENTER);
      textPaint.setTextSize(20);
      textPaint.setTypeface(Typeface.DEFAULT_BOLD);

      canvas.drawText("Some Text", 100, 100, strokePaint);
      canvas.drawText("Some Text", 100, 100, textPaint);

      }




      <ImageView
      android:id="@+id/myImageView"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:src="@drawable/img_1" />

      <vbright.usanin.salesRegion.Text.TextViewOutline
      android:id="@+id/myImageViewText"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_alignBottom="@+id/myImageView"
      android:layout_alignLeft="@+id/myImageView"
      android:layout_alignRight="@+id/myImageView"
      android:layout_alignTop="@+id/myImageView" />




      enter image description here










      share|improve this question














      how to place the text in the bottom center?



      my implementation



       @Override
      protected void onDraw(Canvas canvas) {

      Paint strokePaint = new Paint();
      strokePaint.setARGB(255, 0, 0, 0);
      //strokePaint.setTextAlign(Paint.Align.CENTER);


      strokePaint.setTextSize(20);
      strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
      strokePaint.setStyle(Paint.Style.STROKE);
      strokePaint.setStrokeWidth(5);

      Paint textPaint = new Paint();
      textPaint.setARGB(255, 255, 255, 255);
      //textPaint.setTextAlign(Paint.Align.CENTER);
      textPaint.setTextSize(20);
      textPaint.setTypeface(Typeface.DEFAULT_BOLD);

      canvas.drawText("Some Text", 100, 100, strokePaint);
      canvas.drawText("Some Text", 100, 100, textPaint);

      }




      <ImageView
      android:id="@+id/myImageView"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:src="@drawable/img_1" />

      <vbright.usanin.salesRegion.Text.TextViewOutline
      android:id="@+id/myImageViewText"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_alignBottom="@+id/myImageView"
      android:layout_alignLeft="@+id/myImageView"
      android:layout_alignRight="@+id/myImageView"
      android:layout_alignTop="@+id/myImageView" />




      enter image description here







      android textview






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 5 '12 at 10:33









      Max UsaninMax Usanin

      1,27952859




      1,27952859
























          3 Answers
          3






          active

          oldest

          votes


















          1














          Use RelativeLayout to position your text wherever you want. In your case android:layout_alignParentBottom="true" and android:layout_centerHorizontal="true" do magic.



          <RelativeLayout  
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical"
          android:paddingTop="5dip" >

          <TextView
          android:id="@+id/txtExistingService"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_centerHorizontal="true">
          </TextView>


          Hope it helps.






          share|improve this answer
























          • canvas.drawText("Some Text", 10, 50, textPaint); ;)

            – Max Usanin
            Nov 5 '12 at 11:09











          • you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours

            – vinothp
            Nov 5 '12 at 11:14





















          1














          You can use like below code



          <LinearLayout 
          android:orientation="horizontal"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="bottom|center_horizontal"
          android:layout_marginBottom="1dip"
          >

          <Button
          android:text="Bottom Center"
          android:id="@+id/choose"
          android:layout_width="wrap_content"
          android:layout_gravity="center"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          />

          <LinearLayout />





          share|improve this answer































            0














            The most simple answer just click "gravity" on your imageView attributes and check "bottom" and "center_horizontal".






            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%2f13230262%2fhow-to-place-the-text-in-the-bottom-center%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              Use RelativeLayout to position your text wherever you want. In your case android:layout_alignParentBottom="true" and android:layout_centerHorizontal="true" do magic.



              <RelativeLayout  
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical"
              android:paddingTop="5dip" >

              <TextView
              android:id="@+id/txtExistingService"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_centerHorizontal="true">
              </TextView>


              Hope it helps.






              share|improve this answer
























              • canvas.drawText("Some Text", 10, 50, textPaint); ;)

                – Max Usanin
                Nov 5 '12 at 11:09











              • you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours

                – vinothp
                Nov 5 '12 at 11:14


















              1














              Use RelativeLayout to position your text wherever you want. In your case android:layout_alignParentBottom="true" and android:layout_centerHorizontal="true" do magic.



              <RelativeLayout  
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical"
              android:paddingTop="5dip" >

              <TextView
              android:id="@+id/txtExistingService"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_centerHorizontal="true">
              </TextView>


              Hope it helps.






              share|improve this answer
























              • canvas.drawText("Some Text", 10, 50, textPaint); ;)

                – Max Usanin
                Nov 5 '12 at 11:09











              • you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours

                – vinothp
                Nov 5 '12 at 11:14
















              1












              1








              1







              Use RelativeLayout to position your text wherever you want. In your case android:layout_alignParentBottom="true" and android:layout_centerHorizontal="true" do magic.



              <RelativeLayout  
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical"
              android:paddingTop="5dip" >

              <TextView
              android:id="@+id/txtExistingService"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_centerHorizontal="true">
              </TextView>


              Hope it helps.






              share|improve this answer













              Use RelativeLayout to position your text wherever you want. In your case android:layout_alignParentBottom="true" and android:layout_centerHorizontal="true" do magic.



              <RelativeLayout  
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical"
              android:paddingTop="5dip" >

              <TextView
              android:id="@+id/txtExistingService"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_centerHorizontal="true">
              </TextView>


              Hope it helps.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 5 '12 at 10:38









              vinothpvinothp

              6,5771550100




              6,5771550100













              • canvas.drawText("Some Text", 10, 50, textPaint); ;)

                – Max Usanin
                Nov 5 '12 at 11:09











              • you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours

                – vinothp
                Nov 5 '12 at 11:14





















              • canvas.drawText("Some Text", 10, 50, textPaint); ;)

                – Max Usanin
                Nov 5 '12 at 11:09











              • you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours

                – vinothp
                Nov 5 '12 at 11:14



















              canvas.drawText("Some Text", 10, 50, textPaint); ;)

              – Max Usanin
              Nov 5 '12 at 11:09





              canvas.drawText("Some Text", 10, 50, textPaint); ;)

              – Max Usanin
              Nov 5 '12 at 11:09













              you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours

              – vinothp
              Nov 5 '12 at 11:14







              you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours

              – vinothp
              Nov 5 '12 at 11:14















              1














              You can use like below code



              <LinearLayout 
              android:orientation="horizontal"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="bottom|center_horizontal"
              android:layout_marginBottom="1dip"
              >

              <Button
              android:text="Bottom Center"
              android:id="@+id/choose"
              android:layout_width="wrap_content"
              android:layout_gravity="center"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              />

              <LinearLayout />





              share|improve this answer




























                1














                You can use like below code



                <LinearLayout 
                android:orientation="horizontal"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|center_horizontal"
                android:layout_marginBottom="1dip"
                >

                <Button
                android:text="Bottom Center"
                android:id="@+id/choose"
                android:layout_width="wrap_content"
                android:layout_gravity="center"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                />

                <LinearLayout />





                share|improve this answer


























                  1












                  1








                  1







                  You can use like below code



                  <LinearLayout 
                  android:orientation="horizontal"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom|center_horizontal"
                  android:layout_marginBottom="1dip"
                  >

                  <Button
                  android:text="Bottom Center"
                  android:id="@+id/choose"
                  android:layout_width="wrap_content"
                  android:layout_gravity="center"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  />

                  <LinearLayout />





                  share|improve this answer













                  You can use like below code



                  <LinearLayout 
                  android:orientation="horizontal"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom|center_horizontal"
                  android:layout_marginBottom="1dip"
                  >

                  <Button
                  android:text="Bottom Center"
                  android:id="@+id/choose"
                  android:layout_width="wrap_content"
                  android:layout_gravity="center"
                  android:layout_height="wrap_content"
                  android:layout_weight="1"
                  />

                  <LinearLayout />






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 5 '12 at 10:38









                  Nirav RanparaNirav Ranpara

                  13.4k33556




                  13.4k33556























                      0














                      The most simple answer just click "gravity" on your imageView attributes and check "bottom" and "center_horizontal".






                      share|improve this answer




























                        0














                        The most simple answer just click "gravity" on your imageView attributes and check "bottom" and "center_horizontal".






                        share|improve this answer


























                          0












                          0








                          0







                          The most simple answer just click "gravity" on your imageView attributes and check "bottom" and "center_horizontal".






                          share|improve this answer













                          The most simple answer just click "gravity" on your imageView attributes and check "bottom" and "center_horizontal".







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 23 '18 at 11:50









                          NialixusNialixus

                          95




                          95






























                              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%2f13230262%2fhow-to-place-the-text-in-the-bottom-center%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







                              這個網誌中的熱門文章

                              Xamarin.form Move up view when keyboard appear

                              Post-Redirect-Get with Spring WebFlux and Thymeleaf

                              Anylogic : not able to use stopDelay()