Sunday, August 1, 2010

[android-developers] Re: allign text vertically in a text view

yeah it works ... thanks a lot paul...:)
hey Paul I have posted one more query regarding pinch in pinch out
zoom.... can u plz check and share ur idea on that and help me in
resolving it .. PLZZZZZZZ

On Jul 28, 12:50 pm, Paul Turchenko <paul.turche...@gmail.com> wrote:
> Yeah, no problem with that. Just declare you DemoView in the layout.
> For now it goes like this:
> <LinearLayout ...>
> <ImageView .../>
> <your.package.name.DemoView .../>
> </LinearLayout>
>
> And set this layout to be activity's content.
>
> On Jul 27, 1:32 pm, harshe <hars...@gmail.com> wrote:
>
> > Thanks Paul.....As u said, the following code works well . But it
> > looks like a custom view , i cant see the textview itself. I have set
> > the ContentView to main.XML only but still the views in the main.XML r
> > not seen. am getting an output were i can see only the given string
> > rotated -90 degrees in the specified location. i want this rotation of
> > the string to happen inside the textview and the other components in
> > the main.xml has to be displayed.....do i have to change anything in
> > this code And if i want to add an ImageView next to this textview
> > ( linear layout is horizontal orientation)
> > wat i should do. Please do help me........
>
> > public class textrotate extends Activity {
>
> >     DemoView dview;
> >         /** Called when the activity is first created. */
> >     @Override
> >     public void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
> >         dview= new DemoView(this);
> >         setContentView(dview);
> >        // rotateText("FACEBOOK");
> >     }
>
> >         private class DemoView extends TextView{
>
> >                 public DemoView(Context context) {
> >                         super(context);
> >                         // TODO Auto-generated constructor stub
> >                 }
>
> >                 protected void onDraw(Canvas canvas){
> >                         super.onDraw(canvas);
> >                         // x increases from left to right
> >                         // y increases from top to bottom
> >                         canvas.save();
> >                         //int x=0;
> >                         //int y=0;
> >                         Paint paint= new Paint();
> >                         paint.setStyle(Paint.Style.FILL);
> >                         paint.setColor(Color.WHITE);
> >                         //x=30;
> >                         //y=400;
> >                         paint.setTextSize(40);
> >                         String str2Rotate = "FACEBOOK";
> >                         float py = this.getHeight();
> >             float px = this.getWidth()/8.0f;
> >             //canvas.rotate(180, px, py);
>
> >                         canvas.rotate(-90, px,py);
> >                         canvas.drawText(str2Rotate, px, py, paint);
> >                         canvas.restore();
>
> >                 }
> >         }
>
> > }
>
> > On Jul 27, 3:33 am, Paul Turchenko <paul.turche...@gmail.com> wrote:
>
> > > Inherit from TextView, override measure pass and during draw, rotate
> > > the canvas, call super, restore it. This will do the trick
>
> > > On Jul 26, 12:38 am, harshe <hars...@gmail.com> wrote:
>
> > > > I have a textview placed vertically in an activity.. I Want the text
> > > > within the textview to be shown as bottom to top facing right side.
> > > > Can anyone please help me out..........
> > > > my XML file is
>
> > > > <TextView
> > > >     android:layout_height="200dp"
> > > >     android:layout_width="50dp"
> > > >     android:paddingTop="100dp"
> > > >     android:text="ALL"
> > > >     android:textSize=" 20px"
> > > >     android:autoText="true"
> > > >      android:paddingLeft="5dp"
> > > >      android:layout_gravity="fill_vertical"
> > > >   />

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment