1

トップ(見出し)のテキストとその下の画像、その下の別のテキストのチャンクで構成されるレイアウトを持つフラグメントを使用しています。画像が左に行き、見出しと残りを含むテキストが右に行き、画像の境界を越えると左から始まるようにしたいので、ウェブページのように折り返します(すみません)私のひどい説明のために、私がそれをうまく言えたことを願っています)。既存のコードを再配置したり、目的を達成するために変更を加えたりする方法の手がかりはありますか?

ありがとう!これが私のコードです(autoresizeimageは画像コードです):

 <?xml version="1.0" encoding="utf-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:foo="http://schemas.android.com/apk/res/com.cookie.halloween"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/login_background_gradient" >

        <ScrollView
            android:id="@+id/news_details_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" 
                android:padding="6dp ">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/background_article_body"
                    android:orientation="vertical"
                    android:paddingLeft="10dp"
                    android:paddingTop="@dimen/common_top_padding"
                    android:paddingRight="10dp"
                    android:paddingBottom="10dp" >

                    <com.cookie.halloween.utils.FontTextView
                        android:id="@+id/news_headline"
                        foo:customFont="Cabin-Medium.ttf"
                        android:textSize="18sp"
                        android:textColor="@color/article_headline"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />

                    <com.cookie.halloween.utils.FontTextView
                        android:id="@+id/news_timestamp_and_source"
                        foo:customFont="Roboto-Regular.ttf"
                        android:textSize="11sp"
                        android:textColor="@color/article_source"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />

                    <com.cookie.halloween.views.AutoResizeImageView
                        android:id="@+id/news_image"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginTop="@dimen/common_top_padding"
                        android:layout_marginBottom="@dimen/common_bottom_padding" />

                    <com.cookie.halloween.views.LinkableTextView
                        android:id="@+id/news_body"
                        foo:customFont="Roboto-Regular.ttf"
                        android:textSize="13sp"
                        android:lineSpacingExtra="3dp"
                        android:textColor="@color/article_body"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/related_container"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="9dp"
                    android:background="@drawable/background_article_body"
                    android:orientation="vertical" >

                    <TextView
                        android:id="@+id/related_articles"
                        style="@style/related_buttons"
                        android:layout_width="match_parent"
                        android:layout_height="50dp"
                        android:contentDescription="@string/content_description_related_articles"
                        android:text="@string/content_description_related_articles" />

                    <View
                        android:id="@+id/related_divider"
                        android:layout_width="match_parent"
                        android:layout_height="1dp"
                        android:background="@color/related_divider"
                        android:layout_marginLeft="1dp"
                        android:layout_marginRight="1dp"
                        android:visibility="gone" />

                    <TextView
                        android:id="@+id/related_quotes"
                        style="@style/related_buttons"
                        android:layout_width="match_parent"
                        android:layout_height="50dp"
                        android:contentDescription="@string/content_description_related_quotes"
                        android:text="@string/content_description_related_quotes" />
                </LinearLayout>
            </LinearLayout>
        </ScrollView>

        <include layout="@layout/loading_no_results" />

    </FrameLayout>
4

6 に答える 6

2

ここに画像の説明を入力@justice私はあなたがこれを必要とすることを理解し、これを試してください

flowtextview

画像とテキスト ビューを適切に配置するために使用される jar ファイルです。ここからダウンロードします 。flowtextview

FlowTextView textviewname = new com.pagesuite.flowtext.FlowTextView(
            context);

これを使ってみてください

于 2013-11-13T08:38:59.183 に答える
1

ディメンションと文字列とともに使用したいくつかの外部レイアウトのために、私の側でテストできないため、あなたが何を望んでいるのかはあまり明確ではありません...

しかし、私はまだあなたが実際に聞きたいことを推測しようとしています.

この画像のように、右側に2つのテキストビューがある画像のように...

ここに画像の説明を入力

これがこのレイアウト配置のソースです...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<!-- This is your news item -->
<LinearLayout
    android:id="@+id/news_item_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    <ImageView
        android:id="@+id/news_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/image_description"
        android:src="@drawable/ic_launcher" />
    <LinearLayout
        android:id="@+id/news_text_container"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
        <TextView
            android:id="@+id/news_headline"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/your_headline_"
            android:textAppearance="?android:attr/textAppearanceLarge" />
        <TextView
            android:id="@+id/news_timestamp_and_source"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/your_text_here_"
            android:textAppearance="?android:attr/textAppearanceMedium" />
    </LinearLayout>
</LinearLayout>
<!-- Here you can put your other stuff -->
</LinearLayout>

これが少し役立つことを願っています... :)

于 2013-11-12T08:05:54.813 に答える
0

テキストビューの左側の画像を設定するには、テキストビューで以下のプロパティを使用します。

android:drawableLeft="@drawable/YOURIMAGE"
于 2013-11-01T04:14:13.773 に答える