如何设计从右到左线性布局 [英] how to design right to left linear layout

查看:196
本文介绍了如何设计从右到左线性布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先对不起我的星期的英语! ;)

first sorry about my week English language! ;)

我设计了一个layout.this是这个布局的一部分:

I designed a layout.this is part of this layout:

 <ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dip" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/shape_details"
        android:orientation="vertical"
        android:padding="10dip" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="right" >

            <TextView
                android:id="@+id/txt_details_ostan"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:text="Medium Text"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#0000FF" />


            <TextView
                android:id="@+id/textView3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="استان"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#AA0000" />
        </LinearLayout>

我的语言是从右到左。红颜色的主题和蓝色是文本将从数据库中读取
我的问题是,文本有许多字符,并在此布局显示时,话题就会消失,因为我的布局为从左到右,文本将填补所有的布局

my language is right to left. the red colors are topic and the blue colors are text that will read from database my problem is that the text has many character and when shown in this layout , the topic will be disappear because of my layout is "left to right" and the text will fill all layout

我搜索了很多,但我找不到任何方式进行布局从右至左
请帮帮我
谢谢

I searched alot but I can't find any way to be the layout "right to left" please help me thanks

推荐答案

试着做这样的:


  1. 更改您的LinearLayout到RelativeLayout的

  2. 对齐话题父权

  3. 把主题文本到左的话题

下面是一个例子:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:padding="5dip" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:padding="10dip" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="right" >

            <TextView
                android:id="@+id/textView3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:text="استان"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#AA0000" />

            <TextView
                android:id="@+id/txt_details_ostan"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:layout_toLeftOf="@+id/textView3"
                android:text="This is a sample of a long message. It will not push the topic off screen."
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="#0000FF" />

        </RelativeLayout>
    </LinearLayout>
</ScrollView>

这篇关于如何设计从右到左线性布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆