Why doesn't my text be bold when displaying on device screen
- by john123
My string.xml:
<!--I try to bold my argument %s, like below:-->
<string name="hello">Hello to: <b>%s</b> !</string>
My layout main.xml:
<LinearLayout
...>
<TextView
android:id="@+id/hello_txt"
...
.../>
</LinearLayout>
My Fragment class:
public class MyFragment extends Fragment{
TextView helloTxt;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
helloTxt = (TextView) findViewById(R.id.hello_txt);
}
@Override
public void onStart() {
super.onStart();
//pass "Monday" as the argument to my string
helloTxt.setText(String.format(getString(R.string.hello), "Monday"));
}
}
When I run my app on my device, I got "Hello to: Monday !" displaying on screen, but the "Monday" is not bold, but I used <b> in my string.xml. Why it is not bold??