简体   繁体   English

如何将ImageView周围的TextView与固定的文本行对齐

[英]How to align TextView around ImageView with fixed line of text

Can you please tell me how to align textView around imageview like this 你能告诉我如何像这样在imageview周围对齐textView

 _____
|     |
|_____| Some Dummy text,Some Dummy text,
Some Dummy text,Some Dummy text,S...more 

I want to restrict my TextView only for 2 lines and at the end I will have one TextView or Button called more for more text which will open in pop up. 我只想将TextView限制为2行,最后我将有一个TextView或Button调用更多,以获取更多文本,这些文本将在弹出窗口中打开。

Is it possible to create something like this.? 是否可以创建这样的东西?

It is definitely possible. 绝对有可能。 You need to use RelativeLayout under which you can place each of these views and align them as required. 您需要使用RelativeLayout,可以在其中放置每个视图并根据需要对齐它们。

 <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
  android:layout_height="wrap_content">
 <LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent">

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

     <ImageButton
         android:id="@+id/imageButton1"
         android:layout_width="wrap_content"
         android:layout_height="100dp"
         android:src="@drawable/pic7"
         android:text="image1" />

      <TextView
         android:id="@+id/text"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:gravity="center"
         android:text="Textview1" />

 </LinearLayout>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM