2015-09-21 4 views
3

Прежде всего посмотрите на изображение the pictureограниченное количество текстов в TextView

Я хочу, чтобы текст около «Google» изображение заполнить пустую область под изображением Google, посмотрите на область под изображением Google (в выше pic) пуст и заполняется текст arent.

как я могу это сделать?

XML FILE :::

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:card_view="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:background="@drawable/allbg"> 


<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/imageView8" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/newstop" /> 

<ScrollView 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent"> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 




<!-- Name Label --> 
    <!-- Input Name --> 
<RelativeLayout 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/slidebg" 
android:id="@+id/slidebg" 
android:layout_margin="7dp"> 

    <ImageView 
    android:layout_width="match_parent" 
    android:layout_height="70dp" 
    android:id="@+id/imgad2" 
    android:visibility="visible" 
    android:layout_marginTop="9dp" 
    android:layout_marginBottom="6dp" 
    android:layout_marginLeft="8dp" 
    android:layout_marginRight="6dp" 
    /> 

</RelativeLayout> 










    <TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" 
     android:layout_height="fill_parent" android:layout_width="fill_parent" 
     android:layout_centerInParent="true" android:layout_below="@+id/slidebg" 
     android:layout_margin="5dp"> 
    <TableRow android:id="@+id/TableRow01" android:layout_width="fill_parent" 
     android:layout_height="0px" android:layout_weight="1" > 
     <LinearLayout android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal"> 
<TextView 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:id="@+id/btnshare" 
android:background="@drawable/opbg" 
android:text="Share" 
android:paddingLeft="20dp" 
android:paddingTop="4dp" 
android:textSize="19dp" 
android:textColor="#cccccc"/> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/btncopy" 
       android:background="@drawable/opbg" 
       android:text="Copy" 
       android:paddingLeft="20dp" 
       android:paddingTop="3dp" 
       android:textSize="19dp" 
       android:textColor="#cccccc"/> 

     </LinearLayout> 
     </TableRow></TableLayout> 




<!-- Price Label --> 
    <LinearLayout android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal"> 
     <!-- Button Create Product --> 
     <Button android:id="@+id/btnSave" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="Save Changes" 
      android:layout_weight="1" 
      android:visibility="gone" /> 

     <!-- Button Create Product --> 
     <Button android:id="@+id/btnDelete" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="Delete" 
      android:layout_weight="1" 
      android:visibility="gone" /> 

    </LinearLayout> 

    <TextView android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Price" 
    android:paddingLeft="10dip" 
    android:paddingRight="10dip" 
    android:paddingTop="10dip" 
    android:textSize="17dip" 
    android:visibility="gone" /> 





<!-- Input Price --> 
<EditText android:id="@+id/inputPrice" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="5dip" 
    android:layout_marginBottom="15dip" 
    android:singleLine="true" 
    android:inputType="numberDecimal" 
    android:visibility="gone" /> 

<!-- Description Label --> 

<!-- Input description --> 





    <RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="16dp" 
    android:layout_centerVertical="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:background="@drawable/listrowbg" 
    android:id="@+id/card_view4" 

    card_view:cardCornerRadius="4dp" 
    android:layout_centerHorizontal="true" 
    android:layout_marginLeft="5dp" 
    android:layout_marginRight="5dp" 
    android:layout_marginTop="5dp" 
    android:layout_below="@+id/TableLayout01"> 

<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:id="@+id/titcon"> 

    <TextView 
     android:id="@+id/tvname" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:paddingTop="6dip" 
     android:paddingLeft="6dip" 
     android:textSize="16dp" 
     android:textColor="#fafafa" 
     android:textDirection="ltr" 
     android:textStyle="bold" 
    android:maxWidth="200dp" 
     android:width="200dp" 
     android:phoneNumber="false" 
     android:text="Abadi - SohMj" 
     android:layout_marginTop="-4dp" /> 




    <ImageView 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/newshead" 
android:id="@+id/titsp" 

     /> 

</RelativeLayout> 

<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_below="@+id/titcon"> 



    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="این متن خبر تست است!" 
     android:id="@+id/tvdes" 
     android:maxLines="90" 


    android:ellipsize="end" 
     android:textSize="18dp" 
      android:singleLine="false" 
     android:textDirection="rtl" 
     android:textColor="#fcf8f8f8" 
     android:layout_weight="0.95" 
     android:maxLength="20000" 

     android:layout_alignParentRight="true" 
     android:layout_alignParentEnd="true" 

     android:layout_toRightOf="@+id/linearLayout2" 
     android:layout_toEndOf="@+id/linearLayout2" 
     android:weightSum="1"/> 


<LinearLayout 
    android:layout_width="130dp" 
    android:layout_height="130dp" 
    android:gravity="left|top" 

    android:id="@+id/linearLayout2" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:clickable="false"> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/image" 
/> 
</LinearLayout> 


</RelativeLayout> 



</RelativeLayout> 


    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="تمامی اخبار و نوشته ها حق رپفارسی می باشد و هرگونه کپی پیگرد دارد." 
     android:id="@+id/textView2" 
     android:layout_gravity="center_horizontal" 
     android:layout_below="@+id/card_view4" 
     android:textColor="#fff" 
     android:textSize="14dp" 
     android:gravity="center" 
     android:textStyle="bold" 
     android:layout_marginTop="5dp" /> 

</RelativeLayout> 
</ScrollView> 



    </LinearLayout> 
+0

Показать XML файл, пожалуйста –

ответ

1

Используйте эту библиотеку для упаковки текст вокруг изображения ..

https://github.com/deano2390/FlowTextView

+0

привет, им сталкиваются с проблемой с импортом этого проекта; можете мне наказать? – AliAk

+0

он работает нормально, я использовал его ... я использую intellij 14.1.4 .... Покажите мне ошибку, с какими проблемами вы столкнулись ... и также какой тип сборки вы используете (eclipse, intellij, андроид-студия) .. –

0

Дайте номер в атрибуте в XML

android:maxLength="100" 
+0

ребята код просто устанавливая максимальную длину для просмотра текста, я попытался коды, но строки все еще есть пустые места, как картинка ... – AliAk

+0

Вы хотите заполнить пространство под изображением Google? Тогда почему вы спросили об ограничении чисел? Необходимо внести изменения в иерархию компоновки. –

+0

Каков идентификатор ресурса изображения Google? Это не понятно в коде. –

0

Вы можете сделать это, установив Max Limit на ваш TextView

... 
    android:layout_height="wrap_content" //your ImageView Height 
    android:maxLines="1" //Number of Lines you need to limit 
    android:maxLength="10" //character limit 
    android:ellipsize="end" 
.. 

..

+0

вы, ребята, код просто устанавливаете максимальную длину для текстового вида, я пробовал коды, но линии по-прежнему имеют пустые места, такие как картинка ... – AliAk

0

Пожалуйста, попробуйте это,

android:maxLength="12" 
+0

вы, ребята, код просто устанавливаете максимальную длину для текстового вида, я пробовал коды, но линии все еще есть пустые места, как картинка ... – AliAk

+0

не может понять, что вы имеете в виду для меня. Пожалуйста, скажите мне подробно –

+0

Посмотрите на изображение, которое я опубликовал ..... часть, что текст и Google рис. – AliAk

Смежные вопросы