导航:首页 > 操作系统 > android文字竖排

android文字竖排

发布时间:2022-06-18 01:59:37

android的在同一个layout如何竖排实现输出

LinearLayout 中设置 android:orientation="vertical" 这样就是竖直排列 LinearLayout 中的所有子布局都是竖直的 你把 A 图片 B 依次写在LinearLayout 中就行了

⑵ android 自定义viewgroup 怎么让子view竖着排

添加的子View,如果用hierarchyviewer工具可以看到,而你看不到,那么可能原因有:
1、是你添加子View的时候里面已经有View了,并被盖住了。可以先调用removeAllViews()试下。
2、oncreate能看到,onresume不能看到,调用setContentView()方法试下,应该是没有刷新当前界面

⑶ Android给图片添加竖排文字水印

就下载一个加水印的软件就可以了。
文字水印代码:
privateBitmapcreateBitmap(Bitmapphoto,Stringstr,intmark_x,intmark_y){
intwidth=photo.getWidth(),hight=photo.getHeight();
System.out.println("宽"width"高"hight);
//建立一个空的BItMap
Bitmapicon=Bitmap.createBitmap(width,hight,Bitmap.Config.ARGB_8888);
//初始化画布绘制的图像到icon上
Canvascanvas=newCanvas(icon);

PaintphotoPaint=newPaint();//建立画笔
photoPaint.setDither(true);//获取跟清晰的图像采样
photoPaint.setFilterBitmap(true);//过滤一些

//创建一个指定的新矩形的坐标
Rectsrc=newRect(0,0,photo.getWidth(),photo.getHeight());
//创建一个指定的新矩形的坐标
Rectdst=newRect(0,0,width,hight);
//将photo缩放或则扩大到dst使用的填充区photoPaint
canvas.drawBitmap(photo,src,dst,photoPaint);

⑷ Android:多张竖着的图片(一屏幕放不下)用什么实现

网络加载还是你直接写,1.不行就写个listview,2.非得放在一个屏幕里就linearlayout里边加权重weight=“1”,就可以了但是图片可能都是小小的。
方法一 就是item点击事件,然后switch(pos)case 0-5。方法二就是每一个都加id做点击事件。
还有一个办法,非要竖向单排么,可以竖向双排,或者竖向3排么,recycleview了解一下。 item事件需要自己写。

⑸ Android 如何实现竖排文字显示

在android.graphics.Canvas类中有个沿路径画字的方法
void drawTextOnPath(String text, Path path, float hOffset, float vOffset, Paint paint)
Draw the text, with origin at (x,y), using the specified paint, along the specified path.
void drawTextOnPath(char[] text, int index, int count, Path path, float hOffset, float vOffset, Paint paint)
Draw the text, with origin at (x,y), using the specified paint, along the specified path.

Test.java代码://需要在layout中定义Test,且设置背景,在java代码中设置test Text

public class Test extends View {

private Paint paint;
private Path path;
private Matrix matrix;
private int width = -1;
private int height = -1;
private float left = 3;
private float top = 18;
private String title = "";
BitmapDrawable drawable = (BitmapDrawable) getBackground();

public Test(Context context, AttributeSet attrs) {
super(context, attrs);
paint = new Paint();
paint.setColor(Color.WHITE);//定义字体颜色
paint.setTextSize(14);//定义字体大小
path = new Path();
path.lineTo(0,500);//定义字符路径
matrix = new Matrix();
Log.v("onMeasure", "2");
}

@Override
protected void onDraw(Canvas canvas) {
//画背景
Bitmap b = Bitmap.createBitmap(drawable.getBitmap(),0,0,width,height);
canvas.drawBitmap(b, matrix, paint);
//画字
showText(canvas, title);
}

private void showText(Canvas canvas, String text){
float w;
final int len = text.length();
float py = 0 + top;
for(int i=0; i<len; i ++){
char c = text.charAt(i);
w = paint.measureText(text, i, i+1);//获取字符宽度
StringBuffer b = new StringBuffer();
b.append(c);
if(py > 81){//定义字的范围
return;
}
if(isChinese(c)){
py += w;
if(py > 81){
return;
}
canvas.drawText(b.toString(), left, py, paint); //中文处理方法
}else {
canvas.drawTextOnPath(b.toString(), path, py, -left-2, paint);//其他文字处理方法
py += w;
}
}
}

public void setText(String title){
this.title = title;
}

public String getText(){
return title;
}

private boolean isChinese(char c) {
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) {
return true;
}
return false;
}

//重写View大小方法,使view大小为背景图片大小
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (null != getBackground()) {

int h = drawable.getIntrinsicHeight();
int w = drawable.getIntrinsicWidth();
Log.v("onMeasure", "null != getBackground() h:" + h + " w:" + w);
width = w;
height = h;
setMeasuredDimension(w, h);
} else {
width = widthMeasureSpec;
height = heightMeasureSpec;
super.measure(widthMeasureSpec, heightMeasureSpec);
}
}

}

在Android中,若要通过程序改变屏幕显示的方向,必须要覆盖setRequestedOrientation()方法,而若要取得目前的屏幕方向,则需要访问getRequestedOrientation()方法。本范例为求简要示范更改做法,设计了一个按钮,当单击按钮的同时,判断当下的屏幕方向,例如竖排(PORTRAIT),则将其更改为横排(LANDSCAPE);若为横排(LANDSCAPE),则将其更改为竖排(PORTRAIT)

⑹ 怎么让textview中的文字竖着显示

public class RotateTextView extends TextView {
private static final String NAMESPACE = "
private static final String ATTR_ROTATE = "rotate";
private static final int DEFAULTVALUE_DEGREES = 0;
private int degrees ;
public RotateTextView(Context context){
super(context);
}
public RotateTextView(Context context, AttributeSet attrs) {
super(context, attrs);
degrees = attrs.getAttributeIntValue(NAMESPACE, ATTR_ROTATE, DEFAULTVALUE_DEGREES);
}
public RotateTextView(Context context, AttributeSet attrs,int defStyle) {
super(context, attrs,defStyle);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.rotate(degrees,getMeasuredWidth()/2,getMeasuredHeight()/2);
super.onDraw(canvas);
}
}

<com.test.RotateTextView xmlns:myrotate="
android:layout_height="wrap_content"
android:layout_marginTop="468dip"
android:padding="60dip"
android:linksClickable="true"
android:autoLink="web"
android:gravity="center"
android:id="@+id/test"
myrotate:rotate="-45"
android:textSize="20dip"
android:text="7\n\n16"/>

⑺ 如何让textview中的文字竖着显示

public class RotateTextView extends TextView {
private static final String NAMESPACE = "
private static final String ATTR_ROTATE = "rotate";
private static final int DEFAULTVALUE_DEGREES = 0;
private int degrees ;
public RotateTextView(Context context){
super(context);
}
public RotateTextView(Context context, AttributeSet attrs) {
super(context, attrs);
degrees = attrs.getAttributeIntValue(NAMESPACE, ATTR_ROTATE, DEFAULTVALUE_DEGREES);
}
public RotateTextView(Context context, AttributeSet attrs,int defStyle) {
super(context, attrs,defStyle);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.rotate(degrees,getMeasuredWidth()/2,getMeasuredHeight()/2);
super.onDraw(canvas);
}
}

<com.test.RotateTextView xmlns:myrotate="http://myrotate.com/apk/res/myrotate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="468dip"
android:padding="60dip"
android:linksClickable="true"
android:autoLink="web"
android:gravity="center"
android:id="@+id/test"
myrotate:rotate="-45"
android:textSize="20dip"
android:text="7\n\n16"/>

⑻ Android 如何实现竖排文字显示

package com.coolsoft.attributionreject.tools;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.TextView;

public class VerticalTextView extends LinearLayout{

public VerticalTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(VERTICAL);
this.context=context;
}
private String text;
private Context context;
private int color;
private int size=15;

public VerticalTextView(Context context) {
super(context);
setOrientation(VERTICAL);
this.context=context;
}

public void setText(String text)
{
this.text=text;
addText();
}

private void addText()
{
removeAllViews();
if(text!=null)
{
char[] chara=text.toCharArray();
for(int i=0;i<chara.length;i++)
{
System.out.println("什么情况------"+text);
TextView oneText=new TextView(context);
oneText.setTextColor(color);

oneText.setText(text.substring(i, i+1));
if(size>0)
{
oneText.setTextSize(size);
}
addView(oneText);
}
}

}
public void setTextColor(int color)
{
this.color=color;
}
public void setTextSize(int size)
{
this.size=size;
}

}
你也可以修改里边的字体大小的。最好字数不要多,这样的空间字数多了消耗比较的大。
在xml当中加入包名,这个应该知道吧。

⑼ 安卓手机怎么设置竖排方向锁定

在待机界面,从屏幕顶端往下拉,会看到一些常用菜单。找到屏幕锁定那个功能,横屏时候按锁定就是横屏,竖屏时候按锁定就是竖屏。不按锁定的话手机会根据使用方向自动切换横屏或者竖屏。

阅读全文

与android文字竖排相关的资料

热点内容
解除pdf密码 浏览:707
光棍程序员闯关 浏览:564
2016android版本下载 浏览:42
程序员开车卖服装 浏览:395
快速记忆法pdf 浏览:518
java定义异常类 浏览:709
的运行命令 浏览:587
24v电动驻车空调压缩机 浏览:842
老程序员编程步骤 浏览:305
物理去除加密软件 浏览:227
汇编语言可调试编译器 浏览:447
jpeg如何转成pdf 浏览:841
微机室为什么有服务器 浏览:657
安卓手机怎么打语音电话不断网 浏览:458
单片机汇编头文件 浏览:946
juniper命令行 浏览:68
程序员咨询销售工作怎么样 浏览:782
苹果文件服务器是什么 浏览:180
企业透明加密软件有监视功能吗 浏览:494
桌面的运行命令 浏览:10