Rob*_*bin 0 user-interface android alignment textview
我目前正在从服务器的xml文件中将文本加载到我的应用程序中.但是,这些文本被分配给TextView.根据我的需要,我的文字没有对齐.即我希望那些文本作为微软词的理由.
<TextView android:id="@+id/nvContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"
android:layout_weight="1"
android:gravity="fill"
android:text="Inglot Cosmetics now in Kathmandu Inglot, which has been selling its products in over 240 stores all over the world is now here for you in Kathmandu. It has one of the most extensive colour ranges in cosmetics collections. Working with the best makeup artists, Inglot brings you the latest trends in colour, texture and form. Experiment with countless shades and combinations of face powder, blushers, eye shadows and lipsticks."
android:textColor="#ff000000"
android:textSize="14sp" />
Run Code Online (Sandbox Code Playgroud)
文字有点长.我的应用程序不像textview那样显示文本对齐方式.我希望这些文字合理.这可能吗?我在stackoverflow.com上读到,Android不支持文本对齐,因为它是合理的.任何替代品.或者我的xml文件应该做什么?
你可以试试:
android:gravity="center"
Run Code Online (Sandbox Code Playgroud)
代替
android:gravity="fill"
Run Code Online (Sandbox Code Playgroud)
并且还提供一些填充android:padding.
<TextView
android:id="@+id/nvContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"
android:padding="10dp"
android:gravity="center"
android:text="Inglot Cosmetics now in Kathmandu Inglot, which has been selling its products in over 240 stores all over the world is now here for you in Kathmandu. It has one of the most extensive colour ranges in cosmetics collections. Working with the best makeup artists, Inglot brings you the latest trends in colour, texture and form. Experiment with countless shades and combinations of face powder, blushers, eye shadows and lipsticks."
android:textColor="#ff000000"
android:textSize="14sp" />
Run Code Online (Sandbox Code Playgroud)
输出: 我使用上面的XML布局得到了以下输出:

| 归档时间: |
|
| 查看次数: |
8024 次 |
| 最近记录: |