2015-08-26 6 views
0

Мне нужно иметь активность с layout. У меня есть 3 номера: - выбор лучшего/облегченного макета для этого. Я попробовал relativeLayout и Linear (с layout_weight), но нелегко изменить элементы, как на скриншоте. Будет ли TableLayout решением? - Кнопки должны быть похожими на скриншот, изображения. Я пробовал использовать кнопки с drawableLeft = "@ drawable/...", но это не сработало. Я просто хочу добавить TextView с фоном и сделать их clickabke. - черная вертикальная линия. Сначала я хотел сделать фон основного макета черным и иметь 2 макета сверху с небольшим отрывом между ними, чтобы имитировать черную вертикальную линию., который подходит для 3buttons/3states android app

код у меня ниже, но изображения все друг на друга ..

Спасибо за любые советы/идеи!

 <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:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:paddingBottom="@dimen/activity_vertical_margin" 
tools:context="com.huberlin.taptool.TT_Classes.Designer_Classes.TT_Settings2" 
android:background="#000000"> 

<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="35" 
    android:background="#EE3333"> 

    <TextView 
     android:id="@+id/cfg_about" 
     android:text="@string/tt_cfg_aboutBtn" 
     android:background="@drawable/disabled2x" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textStyle="bold" 
     android:typeface="normal" 

     android:singleLine="true" /> 

    <TextView 
     android:id="@+id/cfg_save" 
     android:text="@string/tt_cfg_saveBtn" 
     android:background="@drawable/disabled2x" 
     android:layout_width="fill_parent" 
     android:layout_height="10dp" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textStyle="bold" 
     android:typeface="normal" 
     android:singleLine="true" /> 

    <TextView 
     android:id="@+id/cfg_items" 
     android:text="@string/tt_cfg_saveBtn" 
     android:background="@drawable/disabled2x" 
     android:layout_width="fill_parent" 
     android:layout_height="10dp" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textStyle="bold" 
     android:typeface="normal" 
     android:singleLine="true" /> 

</LinearLayout> 

<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="65" 
    android:background="#EFEFF4" 
    android:layout_marginLeft="0.1dp"> 
</LinearLayout> 

ответ

0

Чтобы решить проблему с изображениями просто указать ориентацию родительского LinearLayout к вертикали.

<LinearLayout 
    android:layout_width="0dp" 
    android:layout_height="match_parent" 
    android:layout_weight="35" 
    android:background="#EE3333" 
    android:orientation="vertical"> 

    <TextView 
     android:id="@+id/cfg_about" 
     android:text="@string/tt_cfg_aboutBtn" 
     android:background="@drawable/disabled2x" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textStyle="bold" 
     android:typeface="normal" 

     android:singleLine="true" /> 

    <TextView 
     android:id="@+id/cfg_save" 
     android:text="@string/tt_cfg_saveBtn" 
     android:background="@drawable/disabled2x" 
     android:layout_width="fill_parent" 
     android:layout_height="10dp" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textStyle="bold" 
     android:typeface="normal" 
     android:singleLine="true" /> 

    <TextView 
     android:id="@+id/cfg_items" 
     android:text="@string/tt_cfg_saveBtn" 
     android:background="@drawable/disabled2x" 
     android:layout_width="fill_parent" 
     android:layout_height="10dp" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textStyle="bold" 
     android:typeface="normal" 
     android:singleLine="true" /> 

</LinearLayout> 

Надеюсь, это может вам помочь.

Смежные вопросы