Issue
I have created small rounded buttons and trying to put them right next to an include but I can't seem to get the round buttons next to the include. I can only get the rounded buttons above the include.
What I have gotten
What I would like to achieve
activty_mediation_tracker.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="@color/colorBlack"
tools:context="com.richard.worktracker.MeditationTrackerActivity">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/topBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@color/colorPrimary"
android:orientation="horizontal">
<ImageView
android:id="@+id/acton_bar_imageView"
android:layout_width="100dp"
android:layout_height="70dp"
android:layout_gravity="center_horizontal"
android:layout_margin="5dp"
android:background="@mipmap/ic_app_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorWhite" />
</LinearLayout>
<ScrollView 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:layout_below="@+id/topBar"
tools:context="com.richard.worktracker.MeditationTrackerActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btnGuru"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GURU"
android:layout_marginLeft="50dp"
tools:layout_editor_absoluteX="143dp"
tools:layout_editor_absoluteY="5dp" />
<Button
android:id="@+id/btnLearn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="LEARN" />
<Button
android:id="@+id/btnPower"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="POWER" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".75"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="20dp"
android:text="30 Day Ave"
android:textColor="@color/colorGolden"
android:textSize="18dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="DAILY MUST"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorWhite"
android:textSize="25dp" />
</LinearLayout>
<!--<include-->
<!--android:id="@+id/activity_item_money"-->
<!--layout="@layout/money_activity_item" />-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btnMediateLevel1"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginLeft="150dp"
android:background="@drawable/roundedbutton"
/>
<Button
android:id="@+id/btnMediateLevel2"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginLeft="10dp"
android:background="@drawable/roundedbutton" />
<Button
android:id="@+id/btnMediateLevel3"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginLeft="10dp"
android:background="@drawable/roundedbutton"
/>
</LinearLayout>
<include
android:id="@+id/activity_item_meditate"
layout="@layout/meditation_activity_item"
/>
<include
android:id="@+id/activity_item_exercise"
layout="@layout/exercise_activity_item" />
<!--<include-->
<!--android:id="@+id/activity_item_study"-->
<!--layout="@layout/study_activity_item" />-->
<!--<include-->
<!--android:id="@+id/activity_item_crush"-->
<!--layout="@layout/crush_activity_item" />-->
<!--<include-->
<!--android:id="@+id/activity_item_create"-->
<!--layout="@layout/create_activity_item" />-->
<include
android:id="@+id/activity_item_fun"
layout="@layout/fun_activity_item" />
<TextView
android:id="@+id/tv_current_time"
android:layout_width="170dp"
android:layout_height="40dp"
android:layout_marginLeft="90dp"
android:gravity="center"
android:text="Hello World!"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorGreen"
android:textSize="36dp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include
android:id="@+id/activity_item_work"
layout="@layout/work_activity_item" />
<include
android:id="@+id/activity_item_other"
layout="@layout/other_activity_item" />
<Button
android:id="@+id/btnAngel"
android:layout_width="165dp"
android:layout_height="match_parent"
android:onClick="handleClick"
android:layout_marginLeft="100dp"
android:background="@mipmap/ic_bg_button"
android:text="Angel"
android:textColor="@color/colorBlack"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="45dp"
android:layout_weight="0.20"
android:orientation="vertical">
<ToggleButton
android:id="@+id/button_timer_0"
style="@style/timer_button"
android:layout_height="35dp"
android:background="@drawable/timer5_toggle_bg" />
<ToggleButton
android:id="@+id/button_timer_1"
style="@style/timer_button"
android:layout_height="35dp"
android:background="@drawable/timer10_toggle_bg" />
<ToggleButton
android:id="@+id/button_timer_2"
style="@style/timer_button"
android:layout_height="35dp"
android:background="@drawable/timer15_toggle_bg" />
<ToggleButton
android:id="@+id/button_timer_3"
style="@style/timer_button"
android:layout_height="35dp"
android:background="@drawable/timer20_toggle_bg" />
<ToggleButton
android:id="@+id/button_timer_4"
style="@style/timer_button"
android:layout_height="35dp"
android:background="@drawable/timer30_toggle_bg" />
<ToggleButton
android:id="@+id/button_timer_5"
style="@style/timer_button"
android:layout_height="35dp"
android:background="@drawable/timer1h_toggle_bg" />
<ToggleButton
android:id="@+id/button_timer_6"
style="@style/timer_button"
android:layout_height="35dp"
android:background="@drawable/timercustom_toggle_bg" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:weightSum="1">
<Button
android:id="@+id/button_details"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="0.5"
android:background="@mipmap/ic_bg_button"
android:onClick="handleClick"
android:text="@string/str_details"
android:textColor="@color/colorBlack"
android:textStyle="bold" />
<Button
android:id="@+id/button_about_us"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="0.5"
android:background="@mipmap/ic_bg_button"
android:onClick="handleClick"
android:text="@string/str_about_us"
android:textColor="@color/colorBlack"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:weightSum="1">
<Button
android:id="@+id/btn_Calculation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="0.5"
android:background="@mipmap/ic_bg_button"
android:onClick="handleClick"
android:text="Calculations"
android:textColor="@color/colorBlack"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</ScrollView>
roundedbutton.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FF2A2A" />
<corners android:bottomRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:topRightRadius="10dp"
android:topLeftRadius="10dp"/>
</shape>
Thanks.
Solution
See you need to create a new Linear layout with Orientaion "horizontal" in which you will put the those 3 dots layout and the Meditaion Button
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<include
android:id="@+id/activity_item_meditate"
layout="@layout/meditation_activity_item"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/btnMediateLevel1"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginLeft="10dp"
android:background="@mipmap/ic_launcher"
/>
<Button
android:id="@+id/btnMediateLevel2"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginLeft="10dp"
android:background="@mipmap/ic_launcher" />
<Button
android:id="@+id/btnMediateLevel3"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginLeft="10dp"
android:background="@mipmap/ic_launcher"
/>
</LinearLayout>
</LinearLayout>
Answered By - 007
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.