how to place the text in the bottom center
how to place the text in the bottom center?
my implementation
@Override
protected void onDraw(Canvas canvas) {
Paint strokePaint = new Paint();
strokePaint.setARGB(255, 0, 0, 0);
//strokePaint.setTextAlign(Paint.Align.CENTER);
strokePaint.setTextSize(20);
strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(5);
Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
//textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(20);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
canvas.drawText("Some Text", 100, 100, strokePaint);
canvas.drawText("Some Text", 100, 100, textPaint);
}
<ImageView
android:id="@+id/myImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img_1" />
<vbright.usanin.salesRegion.Text.TextViewOutline
android:id="@+id/myImageViewText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/myImageView"
android:layout_alignLeft="@+id/myImageView"
android:layout_alignRight="@+id/myImageView"
android:layout_alignTop="@+id/myImageView" />
android textview
add a comment |
how to place the text in the bottom center?
my implementation
@Override
protected void onDraw(Canvas canvas) {
Paint strokePaint = new Paint();
strokePaint.setARGB(255, 0, 0, 0);
//strokePaint.setTextAlign(Paint.Align.CENTER);
strokePaint.setTextSize(20);
strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(5);
Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
//textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(20);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
canvas.drawText("Some Text", 100, 100, strokePaint);
canvas.drawText("Some Text", 100, 100, textPaint);
}
<ImageView
android:id="@+id/myImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img_1" />
<vbright.usanin.salesRegion.Text.TextViewOutline
android:id="@+id/myImageViewText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/myImageView"
android:layout_alignLeft="@+id/myImageView"
android:layout_alignRight="@+id/myImageView"
android:layout_alignTop="@+id/myImageView" />
android textview
add a comment |
how to place the text in the bottom center?
my implementation
@Override
protected void onDraw(Canvas canvas) {
Paint strokePaint = new Paint();
strokePaint.setARGB(255, 0, 0, 0);
//strokePaint.setTextAlign(Paint.Align.CENTER);
strokePaint.setTextSize(20);
strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(5);
Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
//textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(20);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
canvas.drawText("Some Text", 100, 100, strokePaint);
canvas.drawText("Some Text", 100, 100, textPaint);
}
<ImageView
android:id="@+id/myImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img_1" />
<vbright.usanin.salesRegion.Text.TextViewOutline
android:id="@+id/myImageViewText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/myImageView"
android:layout_alignLeft="@+id/myImageView"
android:layout_alignRight="@+id/myImageView"
android:layout_alignTop="@+id/myImageView" />
android textview
how to place the text in the bottom center?
my implementation
@Override
protected void onDraw(Canvas canvas) {
Paint strokePaint = new Paint();
strokePaint.setARGB(255, 0, 0, 0);
//strokePaint.setTextAlign(Paint.Align.CENTER);
strokePaint.setTextSize(20);
strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(5);
Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
//textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(20);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
canvas.drawText("Some Text", 100, 100, strokePaint);
canvas.drawText("Some Text", 100, 100, textPaint);
}
<ImageView
android:id="@+id/myImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img_1" />
<vbright.usanin.salesRegion.Text.TextViewOutline
android:id="@+id/myImageViewText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@+id/myImageView"
android:layout_alignLeft="@+id/myImageView"
android:layout_alignRight="@+id/myImageView"
android:layout_alignTop="@+id/myImageView" />
android textview
android textview
asked Nov 5 '12 at 10:33
Max UsaninMax Usanin
1,27952859
1,27952859
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
Use RelativeLayout
to position your text wherever you want. In your case android:layout_alignParentBottom="true"
and android:layout_centerHorizontal="true"
do magic.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="5dip" >
<TextView
android:id="@+id/txtExistingService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
</TextView>
Hope it helps.
canvas.drawText("Some Text", 10, 50, textPaint); ;)
– Max Usanin
Nov 5 '12 at 11:09
you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours
– vinothp
Nov 5 '12 at 11:14
add a comment |
You can use like below code
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="1dip"
>
<Button
android:text="Bottom Center"
android:id="@+id/choose"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<LinearLayout />
add a comment |
The most simple answer just click "gravity"
on your imageView attributes and check "bottom"
and "center_horizontal"
.
add a comment |
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f13230262%2fhow-to-place-the-text-in-the-bottom-center%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use RelativeLayout
to position your text wherever you want. In your case android:layout_alignParentBottom="true"
and android:layout_centerHorizontal="true"
do magic.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="5dip" >
<TextView
android:id="@+id/txtExistingService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
</TextView>
Hope it helps.
canvas.drawText("Some Text", 10, 50, textPaint); ;)
– Max Usanin
Nov 5 '12 at 11:09
you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours
– vinothp
Nov 5 '12 at 11:14
add a comment |
Use RelativeLayout
to position your text wherever you want. In your case android:layout_alignParentBottom="true"
and android:layout_centerHorizontal="true"
do magic.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="5dip" >
<TextView
android:id="@+id/txtExistingService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
</TextView>
Hope it helps.
canvas.drawText("Some Text", 10, 50, textPaint); ;)
– Max Usanin
Nov 5 '12 at 11:09
you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours
– vinothp
Nov 5 '12 at 11:14
add a comment |
Use RelativeLayout
to position your text wherever you want. In your case android:layout_alignParentBottom="true"
and android:layout_centerHorizontal="true"
do magic.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="5dip" >
<TextView
android:id="@+id/txtExistingService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
</TextView>
Hope it helps.
Use RelativeLayout
to position your text wherever you want. In your case android:layout_alignParentBottom="true"
and android:layout_centerHorizontal="true"
do magic.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="5dip" >
<TextView
android:id="@+id/txtExistingService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
</TextView>
Hope it helps.
answered Nov 5 '12 at 10:38
vinothpvinothp
6,5771550100
6,5771550100
canvas.drawText("Some Text", 10, 50, textPaint); ;)
– Max Usanin
Nov 5 '12 at 11:09
you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours
– vinothp
Nov 5 '12 at 11:14
add a comment |
canvas.drawText("Some Text", 10, 50, textPaint); ;)
– Max Usanin
Nov 5 '12 at 11:09
you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours
– vinothp
Nov 5 '12 at 11:14
canvas.drawText("Some Text", 10, 50, textPaint); ;)
– Max Usanin
Nov 5 '12 at 11:09
canvas.drawText("Some Text", 10, 50, textPaint); ;)
– Max Usanin
Nov 5 '12 at 11:09
you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours
– vinothp
Nov 5 '12 at 11:14
you can draw text using canvas. but consider various device screen size. I recommend to use relative layout because you can position your text at exactly parent bottom centre. But the decision is yours
– vinothp
Nov 5 '12 at 11:14
add a comment |
You can use like below code
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="1dip"
>
<Button
android:text="Bottom Center"
android:id="@+id/choose"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<LinearLayout />
add a comment |
You can use like below code
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="1dip"
>
<Button
android:text="Bottom Center"
android:id="@+id/choose"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<LinearLayout />
add a comment |
You can use like below code
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="1dip"
>
<Button
android:text="Bottom Center"
android:id="@+id/choose"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<LinearLayout />
You can use like below code
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="1dip"
>
<Button
android:text="Bottom Center"
android:id="@+id/choose"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<LinearLayout />
answered Nov 5 '12 at 10:38
Nirav RanparaNirav Ranpara
13.4k33556
13.4k33556
add a comment |
add a comment |
The most simple answer just click "gravity"
on your imageView attributes and check "bottom"
and "center_horizontal"
.
add a comment |
The most simple answer just click "gravity"
on your imageView attributes and check "bottom"
and "center_horizontal"
.
add a comment |
The most simple answer just click "gravity"
on your imageView attributes and check "bottom"
and "center_horizontal"
.
The most simple answer just click "gravity"
on your imageView attributes and check "bottom"
and "center_horizontal"
.
answered Nov 23 '18 at 11:50
NialixusNialixus
95
95
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f13230262%2fhow-to-place-the-text-in-the-bottom-center%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown