• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Creating Text Boxes with Rounded edges.

retro8

Lurker
Jun 28, 2010
8
0
Hello all,

What I am attempting to do is create several rounded rectangles which are clickable and they will then expand to full screen and have non-editable text in them. The Image below may be of some assistance.

ProjDemo.png


As you can see, I have a mobile phone screen indicated within the black box.
If I am to click on one of the red rectangles on the left it will then expand to a larger red rectangle on the right.

I need the following two answers if possible.

1) What is the best way to create rounded rectangle boxes as shown?
2) Does anyone have any guidance as to how I should go about tweening this. I.E any tutorials they know of?

Thanks,
Retro8

PS. I am not looking for code examples, just advice.
 
I'm not really sure what you want but I can give you a code on a rounded text box.

This is the image I will be using:
2qav13k.gif



This is the HTML code for the rounded textbox:
<div class="loginboxdiv">
<input class="loginbox" name="username" type="text" />
</div>

This is the CSS code for the rounded textbox:
.loginboxdiv
{
margin:0;
height:21px;
width:146px;
background:url(login_bg.gif) no-repeat bottom;
}
.loginbox
{
background:none;
border:none;
width:134px;
height:15px;
margin:0;
padding: 2px 7px 0px 7px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
}

Then you can type in the image.
If you want to make the box larger here is the code:

.loginboxdiv
{
margin:0;
height:CHANGE THIS;
width:CHANGE THIS;
background:url(login_bg.gif) no-repeat bottom;
}
.loginbox
{
background:none;
border:none;
width:CHANGE THIS;
height:CHANGE THIS;
margin:0;
padding: 2px 7px 0px 7px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
}

-Sway
 
Upvote 0
Try this...

Create an XML file in your drawables directory called "rounded_edges.xml" and paste this into it:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
	<solid android:color="#FFFFFF"/>
	<corners android:radius="5px"/>
	<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> 
</shape>

Inside the layout you're using for your Activity, use this:
Code:
		<LinearLayout
			android:orientation="vertical"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:background="@drawable/rounded_edges"
			>
			<TextView 
				android:id="@+id/mytext"
				android:layout_width="200dip"
				android:layout_height="wrap_content"
				android:text="blah blah blah blah"
				android:padding="6dip"
				android:textColor="#000000" />
		</LinearLayout>

You may need to do some tweaking. Hell, you may even be able to discard the LinearLayout and set the android:background of the TextView to @drawable/rounded_edges
 
  • Like
Reactions: balane
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones