标签: text-justify

如何在bash中左对齐文本?

给定一个文本,$txt我怎么能在Bash中将它证明为给定的宽度.

示例(宽度= 10):

如果$txt=hello,我想打印:

hello     |
Run Code Online (Sandbox Code Playgroud)

如果$txt=1234567890,我想打印:

1234567890|
Run Code Online (Sandbox Code Playgroud)

bash printf justify text-justify

29
推荐指数
2
解决办法
3万
查看次数

CSS文本以字母间距对齐

有没有办法使用CSS自动对齐使用字母间距的单词,每个单词在其行中,到定义的宽度?

例如,"像这样的东西"看起来像这样:

是否有一种非突兀的方式将这种样式应用到我的文本中?我相信纯CSS没有这个选项(至少在3之前没有CSS版本,CSS3似乎有一个text-justify属性,但它还没有得到很好的支持),所以js解决方案也没问题.

css justify letter-spacing text-justify

27
推荐指数
2
解决办法
2万
查看次数

如何在android中的WebView中设置文本大小

WebView用来证明文本的合理性.我想知道-

  1. 是否可以在layout文件中设置文本大小?因为我想要不同的屏幕尺寸不同的文字大小.

  2. 并且还有一个问题是在2秒文本显示之后首先出现背景.是否可以立即显示文字?

文字大小为7-8行.

码-

public class Main extends Activity {

       WebView mWebView;

       @Override
       public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);        
          mWebView = (WebView) findViewById(R.id.webview);
          String text = "<html><body>"+"<p align=\"justify\">"+getString(R.string.itext)+"</p>"+"</body></html>"; 
      mWebView .loadData(text, "text/html", "utf-8");
      mWebView .setBackgroundColor(Color.TRANSPARENT);
       }
}
Run Code Online (Sandbox Code Playgroud)

XML的

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:orientation="vertical" 
       android:layout_width="fill_parent"
       android:layout_height="fill_parent" 
       android:background="@drawable/light">

<WebView
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/transparent"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android webview text-size text-justify

20
推荐指数
5
解决办法
4万
查看次数

支持RTL语言的Android Justify spanable Text-view

我需要在android中创建一个自定义文本视图,首先它应该是合理的,然后它应该支持跨度,虽然它应该支持RTL(从右到左)语言ex:Farsi(波斯语),...

我在这个问题上工作了一个星期!但实际上我陷入了困境,因为没有可用的库支持所有这些条件(Justify,Spanable,RTL)

你有什么想法吗?


我虽然为ex:Link检查了很多库

android textview right-to-left text-justify spannablestring

14
推荐指数
1
解决办法
1543
查看次数

Android TextView:android:justificationMode =“inter_word”不适用于android:autoLink =“web”

我有一个文本视图,它必须android:justificationMode="inter_word"对齐 TextView 中的文本。

这工作正常。但现在,当我的 TextView 文本中有一个 URL 时,我想在单击该 URL 时打开浏览器。因此,为了实现这一目标,我添加了android:autoLink="web",但如果我这样做,那么文本对齐就会停止,可点击的链接开始工作。

<androidx.appcompat.widget.AppCompatTextView
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:justificationMode="inter_word"
   android:autoLink="web"
   android:text="" />
Run Code Online (Sandbox Code Playgroud)

笔记:

我也尝试过,

  1. 以编程方式进行活动 textview.setMovementMethod(LinkMovementMethod.getInstance());
  2. 在 XML 中 android:linksClickable="true"

但是,这些都无法实现这两个功能(带有理由文本的可点击链接)

如果有人已经实现了这两件事,请告诉我:TextView 中文本的对齐方式以及其中的可点击链接。

android hyperlink textview text-justify

11
推荐指数
1
解决办法
731
查看次数

UILabel左右对齐

我有UILabel(可可触摸框架),我想左右对齐它的文本.因此,它将拉伸文本内部.

示例:如果我有这个文本" 虽然节省了实际制造和运输成本 ",它将如下所示:

"While the saved"
"c o s t s   o f"
"p h y s i c a l"
 "manufacturing"
"a n d  shipping"
Run Code Online (Sandbox Code Playgroud)

正如你可以看到左右对齐......

我怎么能实现那个???

非常感谢

  • 对不起,我不得不提出双重问题来发布问题.

iphone cocoa-touch uilabel ios text-justify

9
推荐指数
1
解决办法
3万
查看次数

Java中的文本对齐库

可能重复:
我可以设置Textview的属性,例如justify吗?

我正在编写一个需要文本调整的Android应用程序,这本身不支持,我不认为使用WebView会因为与屏幕分辨率和尺寸相关的字体和文本大小而起作用.考虑到这一点,我将编写一个自定义视图,扩展TextView,它将进行文本调整,并想知道是否有人知道我可以看到的任何代码,这已经为我节省了一些时间.任何其他有用的建议也将非常感谢.

java android text-justify

9
推荐指数
1
解决办法
1万
查看次数

HTML证明text-align与<pre>标签

我在带有格式和固定宽度的段落中的text-align"justify"有问题,因为我希望HTML中的段落文本看起来完全合理(就像MS Word文件一样).但是,这不会发生.我需要修改什么来实现它?

     <pre style="color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: medium; width: 500px; text-align: justify;"> 

I have a problem with the text-align "justify" inside a paragraph with format and fixed width, because I want the paragraph text in HTML to appear totally justified (like it would happen with a MS Word file). However, this does not happen. What I need to modify to achieve it?

        </pre>
Run Code Online (Sandbox Code Playgroud)

编辑:如果我用<pre>标签替换<p>标签,我的代码工作正常.有人可以解释一下为什么吗?也许我使用了错误的<pre>标签.

html pre fixed-width text-justify

8
推荐指数
2
解决办法
2万
查看次数

IOS:证明UILabel中的文本在UI中不起作用

我想对齐我的文本,UILabel但似乎不起作用.但是,另一个对齐是左,右,中心工作.
我正在使用XCode 7.2.我已经在模拟器和真实设备上进行了测试,但它产生了同样的问题

对齐Justify 在此输入图像描述

我的文字:

Don't worry, your data will not be sold.Don't worry,your data wills not be sold. Connecting your accounts will benefit your E score and your profile viewing experience. Don't worry, your data will not be sold.Don't worry, your data wills not be sold. Connecting your accounts will benefit your ECT score and your profile viewing experience.
Run Code Online (Sandbox Code Playgroud)

使用font:Helvetica Neue 13.0和trailing/leading:10

同样的问题,如果我在这里使用对齐来证明文本 在此输入图像描述

我不知道为什么这发生在我身上.请给我一些解决方法.任何帮助将非常感谢

xcode uilabel ios text-justify

8
推荐指数
1
解决办法
4545
查看次数

在QtWebKit中显示阿拉伯字体

我用QtWebkit编写了一个程序.我在此应用程序中使用了阿拉伯字体 但是如下所示的文本不适用.是否有解决方案来修复它? 在QtWebkit中显示的文本不适用:http://www.shiaupload.ir/images/47343138299124526783.jpg 显示的文字不适用:

这里有一个示例代码

HTML代码:{

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head>


<style>
/*Twe Arabic font for test:*/
@font-face {
        font-family: '__me_quran';
        src: url(me_quran.ttf) format('truetype');
    }
@font-face {
        font-family: '__traditionalArabic';
        src: url(trado.ttf) format('truetype');
    }
 #para1
{
 font-family :/*__me_quran*/__traditionalArabic;
 text-align : justify;/*In this project i need justify alinement*/
 direction:rtl;
}


</style>
<script type="text/javascript" >
    var step=1;
    function plusZoom1(){
        document.getElementById("para1").style.zoom = parseFloat(step);
        step +=0.5;
    }

    function minusZoom1(){
        step -=0.5;
        document.getElementById("para1").style.zoom = parseFloat(step);
    } …
Run Code Online (Sandbox Code Playgroud)

fonts qt arabic qtwebkit text-justify

6
推荐指数
1
解决办法
1046
查看次数