簡體   English   中英

Android布局TextView

[英]Android Layout TextView

我如何適應這個文本視圖,因此它不會使2個圖像按鈕變形。我想將它放在它們之上2.這就是它們現在出現的方式:

現在布局

這是按鈕的外觀:

這是我的xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:orientation="horizontal">



<ImageButton
    android:layout_width="0dp"
    android:layout_height="400dp"
    android:layout_weight="1"
    android:id="@+id/botoAbdominals"
    android:background="@drawable/abdominals"
    android:contentDescription="ImatgeAbdominals"
    android:layout_marginTop="50dp"
    android:layout_marginRight="10dp"
    android:layout_marginLeft="10dp"
    android:layout_gravity="center"
    />


<ImageButton
    android:layout_width="0dp"
    android:layout_height="400dp"
    android:layout_weight="1"
    android:id="@+id/botoFlexio"
    android:layout_gravity="center"
    android:layout_marginTop="50dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:background="@drawable/flexio"
    android:contentDescription="ImatgeFlexio"
    />
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Escull la rutina desitjada" />

在它周圍放置另一個LinearLayout ,即垂直方向。 將textview和Linearlayout作為子項。

以下層次結構。

> LinearLayout (vertical)
  > TextView
  > LinearLayout (horizontal) // [Like your current one]
    > ImageButton
    > ImageButton

這樣做是這樣的布局安排:

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

    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Escull la rutina desitjada" />

    <LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:weightSum="2"
    android:orientation="horizontal">

        <ImageButton
        android:layout_width="0dp"
        android:layout_height="400dp"
        android:layout_weight="1"
        android:id="@+id/botoAbdominals"
        android:background="@drawable/abdominals"
        android:contentDescription="ImatgeAbdominals"
        android:layout_marginTop="50dp"
        android:layout_marginRight="10dp"
        android:layout_marginLeft="10dp"
        android:layout_gravity="center"/>


        <ImageButton
        android:layout_width="0dp"
        android:layout_height="400dp"
        android:layout_weight="1"
        android:id="@+id/botoFlexio"
        android:layout_gravity="center"
        android:layout_marginTop="50dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:background="@drawable/flexio"
        android:contentDescription="ImatgeFlexio"/>

   </LinearLayout>


</LinearLayout>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM