Выровняйте аналоговые часы андроида по левому краю - PullRequest
1 голос
/ 28 февраля 2012

У меня есть такой xml-файл, который показывает аналоговые часы слева, а также показывает дату и время справа от этого. Но проблема в том, что я не выравниваю часы по левому краю, хотя я пытался разными способами. Как я могу получить часы слева больше всего

     <?xml version="1.0" encoding="utf-8"?>
   <LinearLayout android:orientation="vertical"   android:id="@+id/base_layout"             android:layout_width="fill_parent" android:layout_height="fill_parent"  android:background="@drawable/bgclock"    android:gravity="left"        android:layout_gravity="left"
 xmlns:android="http://schemas.android.com/apk/res/android">

       <LinearLayout 
    android:orientation="horizontal"     android:layout_marginLeft="0dip"   
    android:layout_width="fill_parent"  android:gravity="left"          android:layout_gravity="left"    
    android:layout_height="wrap_content">
        <LinearLayout   
            android:layout_weight="1 " 
            android:layout_height="fill_parent"   android:layout_marginLeft="0dip"   
            android:layout_width="fill_parent"   android:gravity="left" android:paddingLeft="0dip"  android:layout_gravity="left"
            android:orientation="vertical">


     <LinearLayout  android:layout_marginTop="36.0dip"   android:id="@+id/clock_layout"           android:layout_width="fill_parent"     android:layout_marginLeft="0dip"   android:layout_gravity="left"     android:paddingLeft="0dip" android:layout_height="192.0dip" >
   <custom.analog.clock.AnalogClock1 android:id="@+id/clock"  style="@style/clock"     android:gravity="left"       android:layout_marginLeft="0dip"      android:paddingLeft="0dip"    
    xmlns:android="http://schemas.android.com/apk/res/android" />



 </LinearLayout>

   </LinearLayout>

 <LinearLayout   

                android:layout_weight="1.25"
                android:layout_height="fill_parent"
                android:layout_width="fill_parent"
                android:orientation="vertical">

     <!-- 1.25 -->


       <TextView 
    android:id="@+id/textView2" android:layout_marginTop="76.0dip"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Digital Clock"
    android:maxLength="12"
    android:textAppearance="?android:attr/textAppearanceLarge" />

  <DigitalClock
    android:id="@+id/
    digitalClock1"
    android:layout_width="wrap_content"  
    android:layout_height="wrap_content"
    android:text="DigitalClock" /> </LinearLayout>
   </LinearLayout>






       <LinearLayout 
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <Spinner 
    android:id="@+id/spinner"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:prompt="@string/planet_prompt"
/>

<Button
     android:id="@+id/calculate7"
    android:layout_width="280dip"
    android:layout_height="68dip"
    android:clickable="true"

    android:layout_centerHorizontal="true"
    android:layout_marginBottom="12dp"
    android:background="@drawable/button_gettime" />


  </LinearLayout>


       </LinearLayout>

Ответы [ 2 ]

1 голос
/ 28 февраля 2012

Из того, что я вижу, для custom.analog.clock.AnalogClock1 вы устанавливаете только гравитацию влево, гравитация Layout должна быть «влево».Или вы можете просто установить гравитацию (не только Layoutgravity) clock_layout на «left», что должно выровнять все его дочерние элементы влево.

PS Пожалуйста, отформатируйте код xml перед тем, как скопировать его здесь (ctrl + shift + F).

0 голосов
/ 28 февраля 2012

Вы также можете использовать относительное расположение. В котором вы могли бы разместить свою кнопку textview e.t.c, куда бы вы ни захотели поместить их, простым перетаскиванием.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...