Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5937143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:29:51+00:00 2026-05-22T15:29:51+00:00

Pretty much I have a Textview that is acting as a display for asterisks

  • 0

Pretty much I have a Textview that is acting as a display for asterisks when a user clicks a pin pad of Buttons I made.

The buttons have their text centered, but it seems when I append something to the Textview text property the number 2 pin’s layout changes to center at the bottom instead of the dead center. This is part part of the xml:

<!-- PIN text -->
<TableLayout>
    <TableRow android:id="@+id/btn_row1"
        android:gravity="center"
        android:layout_marginTop="6dip">
        <!-- password text-->  
        <TextView
            android:id="@+id/txt_pin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#FFFFFF"
            android:text=""
            android:background="@drawable/txt_background"/>
    </TableRow>
</TableLayout>  
<!-- PIN ends -->
<!-- Header end -->
<!-- PIN button starts -->      
<TableLayout android:id="@+id/table_modes"
    android:layout_marginTop="6dip">
    <!-- First button rows -->  
    <TableRow android:id="@+id/btn_row1"
        android:gravity="center">
        <!-- one button-->  
        <Button android:id="@+id/btn_one"
            android:layout_column="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="3dip"
            android:layout_marginRight="2.5dip"
            android:textColor="#FFFFFF"
            android:text="1"
            android:background="@drawable/button_layout_med" 
            android:onClick="input"/>
        <!-- two Button -->  
        <Button android:id="@+id/btn_two"
            android:layout_column="2"
            android:layout_width="100dip"
            android:layout_height="60dip"
            android:layout_marginLeft="2.5dip"
            android:layout_marginRight="2.5dip"
            android:gravity="center"
            android:textColor="#FFFFFF"
            android:text="2"
            android:background="@drawable/button_layout_med" 
            android:onClick="input"/>
        <!-- 3 button -->  
        <Button android:id="@+id/btn_three"
            android:layout_column="3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="2.5dip"
            android:layout_marginRight="3dip"
            android:textColor="#FFFFFF"
            android:text="3"
            android:background="@drawable/button_layout_med" 
            android:onClick="input"/>
    </TableRow>
    <!-- First row ends -->
 <!-- Rows continue down 3 more then a submit and back button -->

The next part is the java code for OnClick:

public void input(View v){
            Button i = (Button) v;
    TextView tv_pin = (TextView) findViewById(R.id.txt_pin);


    while(view_pin.length() < 10){
        pin.append(i.getText().toString());
        view_pin.append('*');
        tv_pin.setText(view_pin.toString());
        break;
    }

}

Where pin and view_pin are private static variables.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:29:51+00:00Added an answer on May 22, 2026 at 3:29 pm

    To fix this problem I simply had to change the XML code for height and width for the second button to “wrap_content” instead of giving them a static value.

    <!-- two Button -->  
    <Button android:id="@+id/btn_two"
        android:layout_column="2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="2.5dip"
        android:layout_marginRight="2.5dip"
        android:gravity="center"
        android:textColor="#FFFFFF"
        android:text="2"
        android:background="@drawable/button_layout_med" 
        android:onClick="input"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pretty much what the title says really. We have some code that is .NET
I have heard mention that some desktop applications are pretty much just wrappers for
We have a Struts 2 web application that's used by pretty much every employee
I have two functions that have different enough logic but pretty much the same
Pretty much I have a code like below that I'm trying to add </tr><tr>
I have pretty much made my app to about 90% using UIKit code since
I have pretty much finished my first working Symbian application, but in my hastened
I have built a PHP calendar system and have pretty much everything done but
We are working on a datawarehouse for a bank and have pretty much followed
I have a pretty much default installation on mysql on Windows 2003. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.