0

Please have a look at the following code

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:descendantFocusability="afterDescendants"
    android:background="@drawable/background1"
    tools:context=".Form" >

    <TextView
        android:id="@+id/txt1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/dateTxt"
        android:textSize="32sp"
        android:textColor="#FFFFFF"
        android:layout_alignParentLeft="true"

         />

        <DatePicker
        android:id="@+id/datePick"
        android:layout_toRightOf="@+id/txt1"
        android:layout_width="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:layout_height="wrap_content"
        android:layout_marginLeft="4dp"
        />

</RelativeLayout>

In here, I need to make the text of TextView Bold, and if possible, add a text design something like "spread", "spoiled", "blur".

How can I do this? Making the text bold is the main question, if you can please answer to the second question as well.

Thanks

PeakGen
  • 21,894
  • 86
  • 261
  • 463
  • android:TextStyle="bold" (See https://developer.android.com/reference/android/widget/TextView.html#attr_android:textStyle) – Luis Dec 23 '12 at 18:49
  • to bold|italic|normal a text is android textifield is native property but to add custom feature you have to add it programatically – Usman Kurd Dec 23 '12 at 18:57
  • Take a look at the Following Link http://www.jappit.com/blog/2009/01/25/j2me-images-how-to-create-a-reflection-effect/ – Usman Kurd Dec 23 '12 at 18:59

3 Answers3

1
TextView t1=(TextView)findViewById(R.layout.TextView01);
t1.setTypeface(null,Typeface.BOLD);

For design get some idea from it.. http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-basic-font-sizes/

ridoy
  • 6,274
  • 2
  • 29
  • 60
1

Modify Your dateTxt String. Use bold tag.

 <string name="dateTxt"><b> Copyright </b></string>

And for blurry or spoil text , you can make style and then apply on your textView. For doing text blur use this

    <style name="Theme.BlurText" parent="android:style/Theme.Translucent">
   <item name="android:windowNoTitle">true</item>
  <item name="android:windowContentOverlay">@null</item>
  <item name="android:backgroundDimEnabled">true</item>
<item name="android:background">@android:color/transparent</item>        
</style>

And in your textview use

 android:style="@style/Theme.BlurText"
Rahul
  • 10,457
  • 4
  • 35
  • 55
1

To do it via XML I recommend you to create a style. If you don't have any, add a XML file to your 'values' folder named "styles.xml" and add this style to it (I used shadows to try to make some blurry text, but it may not be very effective), anyway you have the bold text as you wanted:

<resources>
     <style name="Text"> </style>

     <style name="Text.Strong">
           <item name="@android:textSize">32sp</item>
           <item name="@android:paddingLeft">4dp</item>
           <item name="@android:paddingBottom">4dp</item>
           <item name="@android:textColor">#FFFFFFFF</item>
           <item name="@android:textStyle">bold</item>
     </style>

     <style name="Text.Strong.Blurry">
           <item name="@android:shadowColor">#BBBBBB</item>
           <item name="@android:shadowDx">1</item>
           <item name="@android:shadowDy">1</item>
           <item name="@android:shadowRadius">10</item>
     </style>
</resources>

Then just apply the style to your TextView:

 <TextView
    android:id="@+id/txt1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@string/dateTxt"
    android:layout_alignParentLeft="true"
    style="@style/Text.Strong.Blurry" />
Sergio Carneiro
  • 3,726
  • 4
  • 35
  • 51