Страница 1 из 1

android:theme="@android:style/Theme.Dialog"

Добавлено: 07 дек 2013, 18:09
IgNa
При добавлении такой строки в манифест
Активити открывается в уменьшенном размере
и View элементы на RelativeLayout ничем не оправдано смещаются в жопу
( но не все, а только

<ImageButton
android:id="@+id/up1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView6"
android:layout_alignParentLeft="true"
android:onClick="clickup1"
android:src="@drawable/up" />

<ImageButton
android:id="@+id/down1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView6"
android:onClick="clickdown1"
android:src="@drawable/down" />

При том что textView6" к которому пределаны обе кнопки, остается на своем месте

Чем объяснить, как можно приспособиться ?

xml на всякий случай

Код: Выделить всё

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="#000" >

    <NumberPicker
        android:id="@+id/numberPicker2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_alignParentRight="true"
        android:layout_marginRight="40dp" />

        <NumberPicker
            android:id="@+id/numberPicker3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        android:layout_centerVertical="true"
            android:layout_toLeftOf="@+id/numberPicker2" />

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginLeft="144dp"
            android:src="@drawable/mon1" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/textView1"
            android:layout_alignLeft="@+id/numberPicker3"
            android:text="  Passive"
            android:textColor="#fff" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/textView2"
            android:layout_alignLeft="@+id/numberPicker2"
            android:text="  Active"
            android:textColor="#fff" />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView1"
            android:layout_alignParentBottom="true"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="48dp"
            android:text="0"
            android:textColor="#fff" />

        <TextView
            android:id="@+id/textView5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/textView4"
            android:layout_alignBottom="@+id/textView4"
            android:layout_toRightOf="@+id/textView4"
            android:text=" %"
            android:textColor="#fff" />

    <TextView
        android:id="@+id/textView6"
        style="@style/AppTheme"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/up1"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp"
        android:background="@drawable/your_bg_shape"
        android:paddingBottom="11dp"
        android:paddingLeft="20dp"
        android:paddingRight="21dp"
        android:paddingTop="11dp"
        android:text="200"
        android:textSize="18sp" />
    

    <ImageButton
        android:id="@+id/up1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textView6"
        android:layout_alignParentLeft="true"
        android:onClick="clickup1"
        android:src="@drawable/up" />

    <ImageButton
        android:id="@+id/down1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/textView6"
        android:onClick="clickdown1"
        android:src="@drawable/down" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/up1"
        android:layout_alignLeft="@+id/textView6"
        android:text="       max"
        android:textColor="#fff" />
        
</RelativeLayout>

Re: android:theme="@android:style/Theme.Dialog"

Добавлено: 07 дек 2013, 18:40
IgNa
Я делаю такие выводы , что всё что не привязано к android:layout_centerVertical="true"
уезжает в жопу

Re: android:theme="@android:style/Theme.Dialog"

Добавлено: 07 дек 2013, 19:06
IgNa
Если кто с подобным столкнется - решение:
Всё что уезжает, суем в лейаут, который привязываем к центру так android:layout_centerVertical="true"

Мое личное мнение: диалоги реализованные через активити со свойством в манифесте Re: android:theme="@android:style/Theme.Dialog"
круче чем все другие диалоги, требующие специальных новых знания и уровней api