在LinearLayout

时间:2015-06-04 05:26:26

标签: android

我需要帮助才能动态地在text1和text2上放置文本,这两个文本都不应超过图像的边框。

例如:

   " Welcome " will be fixed at text2, but in case of "Welcome to the World of Android" may not be ,how could i fix it within the space provided.

我的图像将如下所示并放置在布局的中心。 如何将文本放置在应与所有类型设备兼容的相应位置[Tab& HandSet]以及各种分辨率。

我通过动态创建具有固定边距的单独线性布局并为每个分支放置这些文本来尝试它,但问题是它对所有类型的设备都不好。

这是我的形象:

enter image description here

这里有更多解释的布局

enter image description here

所有这些都是一个整体图像,它保存一个父项Linearlayout,而分支(linear1)只保存带有动态线性布局的文本部分,正如我所说,text1和text2必须在提供的部分内修复。

请发表您的建议。

2 个答案:

答案 0 :(得分:0)

你刚读过Gravity and Padding属性你的问题解决

答案 1 :(得分:0)

circle是png文件,其中circle draw ::

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world" 
    android:gravity="center"
    android:background="@drawable/circle"/>