在横向模式android中创建布局的问题

时间:2015-03-19 06:46:39

标签: android android-layout android-xml graphical-layout-editor

我正在为横向模式创建布局和应用程序,并且布局足够大,因此将所有内容都包装在scrollview中。但是我面临的主要问题是安排对齐屏幕区域之外的布局,因为它在图形布局中不可见。

以下是布局代码,代码中相对布局为Id:@+id/lastjobRL,之后的视图以图形布局模式离开屏幕。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/dashboardtxtLL"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/dashboard_header_txt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#e9f5fe"
        android:padding="@dimen/dashboard_header_txt_padding"
        android:text="@string/dashboard"
        android:textColor="#35617d"
        android:textSize="@dimen/dashboard_txt_size"
        android:textStyle="bold" />

    <ImageView
        android:id="@+id/separator"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:contentDescription="@string/separator_img_description"
        android:src="@drawable/job_details_separator" />

    <ScrollView
        android:id="@+id/dashboardSV"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="#e9f5fe"
        android:paddingBottom="@dimen/dashboard_sv_paddingbottom"
        android:fillViewport="true" >

        <RelativeLayout
            android:id="@+id/dashboardLV"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/dashboard_lv_marginbottom"
            android:layout_marginTop="@dimen/dashboard_lv_marginbottom" >

            <ImageView
                android:id="@+id/SectionBackgrondIMG"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"                           android:layout_marginTop="@dimen/SectionBackgrond_img_margintop"
                android:contentDescription="@string/SectionBackgrond_img"
                android:src="@drawable/sections_background_2x" />

            <RelativeLayout
                android:id="@+id/sectionHZ"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/section_hz_margintop"
                android:gravity="top" >

                <ImageView
                    android:id="@+id/myjobIMG"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_marginLeft="@dimen/myjob_img_marginleft"
                    android:layout_marginStart="@dimen/myjob_img_marginleft"
                    android:contentDescription="@string/myjob_img"
                    android:src="@drawable/my_jobs" />

                <ImageView
                    android:id="@+id/diaryIMG"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:contentDescription="@string/diary_img"
                    android:src="@drawable/diary" />

                <ImageView
                    android:id="@+id/timesheetsIMG"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentRight="true"
                    android:layout_marginLeft="@dimen/timesheets_img_marginleft"
                    android:layout_marginStart="@dimen/timesheets_img_marginleft"
                    android:contentDescription="@string/timesheets_img"
                    android:src="@drawable/timesheet" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/reddotHZ"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/reddpt_hz_margintop"
                android:gravity="top" >

                <ImageView
                    android:id="@+id/myjobreddotIMG"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/myjob_reddot_img_marginleft"
                    android:layout_marginStart="@dimen/myjob_reddot_img_marginleft"
                    android:contentDescription="@string/myjobreddot_img"
                    android:src="@drawable/red_dot" />

                <TextView
                    android:id="@+id/myjobreddotTXT"
                    android:layout_width="@dimen/myjob_reddot_txt_layoutwidth"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/myjob_reddot_txt_marginleft"
                    android:layout_marginStart="@dimen/myjob_reddot_txt_marginleft"
                    android:layout_marginTop="@dimen/myjob_reddot_txt_margintop"
                    android:gravity="center"
                    android:text="@string/myjob_reddot_text"
                    android:textColor="#ffffff"
                    android:textSize="@dimen/timesheets_txt_size"
                    android:textStyle="bold" />

                <ImageView
                    android:id="@+id/diaryreddotIMG"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/diary_reddot_img_marginleft"
                    android:layout_marginStart="@dimen/diary_reddot_img_marginleft"
                    android:contentDescription="@string/diaryreddot_img"
                    android:src="@drawable/red_dot" />

                <TextView
                    android:id="@+id/diaryreddotTXT"
                    android:layout_width="@dimen/diary_reddot_txt_layoutwidth"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/diary_reddot_txt_marginleft"
                    android:layout_marginStart="@dimen/diary_reddot_txt_marginleft"
                    android:layout_marginTop="@dimen/diary_reddot_txt_margintop"
                    android:gravity="center"
                    android:text="@string/diary_reddot_text"
                    android:textColor="#ffffff"
                    android:textSize="@dimen/diary_reddot_txt_size"
                    android:textStyle="bold" />

                <ImageView
                    android:id="@+id/timesheetsreddotIMG"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/timesheets_reddot_img_marginleft"
                    android:layout_marginStart="@dimen/timesheets_reddot_img_marginleft"
                    android:contentDescription="@string/timesheetsreddot_img"
                    android:src="@drawable/red_dot" />

                <TextView
                    android:id="@+id/timesheetsreddotTXT"
                    android:layout_width="@dimen/timesheets_reddot_txt_layoutwidth"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/timesheets_reddot_txt_marginleft"
                    android:layout_marginStart="@dimen/timesheets_reddot_txt_marginleft"
                    android:layout_marginTop="@dimen/timesheets_reddot_txt_margintop"
                    android:gravity="center"
                    android:text="@string/timesheets_reddot_text"
                    android:textColor="#ffffff"
                    android:textSize="@dimen/timesheets_txt_size"
                    android:textStyle="bold" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/labelHZ"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/label_hz_margintop"
                android:gravity="top" >

                <TextView
                    android:id="@+id/myjobTXT"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/myjob_txt_marginleft"
                    android:layout_marginStart="@dimen/myjob_txt_marginleft"
                    android:layout_marginTop="@dimen/myjob_txt_margintop"
                    android:text="@string/myjob"
                    android:textColor="#35617d"
                    android:textSize="@dimen/label_myjob"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/diaryTXT"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/diary_txt_marginleft"
                    android:layout_marginStart="@dimen/diary_txt_marginleft"
                    android:layout_marginTop="@dimen/diary_txt_margintop"
                    android:text="@string/diary"
                    android:textColor="#35617d"
                    android:textSize="@dimen/label_diary"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/timesheetsTXT"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/timesheets_txt_marginleft"
                    android:layout_marginStart="@dimen/timesheets_txt_marginleft"
                    android:layout_marginTop="@dimen/timesheets_txt_margintop"
                    android:text="@string/timesheets"
                    android:textColor="#35617d"
                    android:textSize="@dimen/label_timesheets"
                    android:textStyle="bold" />
            </RelativeLayout>

            <LinearLayout
                android:id="@+id/sectionBTN"
                android:layout_width="match_parent"
                android:layout_height="@dimen/section_btn_layout_hight"
                android:layout_marginTop="@dimen/section_btn_layout_margintop"
                android:gravity="top"
                android:orientation="horizontal"
                android:weightSum="1" >

                <Button
                    android:id="@+id/myjobBTN"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="0.33"
                    android:background="@android:color/transparent" />

                <Button
                    android:id="@+id/dairyBTN"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="0.33"
                    android:background="@android:color/transparent" />

                <Button
                    android:id="@+id/timesheetsBTN"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="0.33"
                    android:background="@android:color/transparent" />
            </LinearLayout>

            <RelativeLayout
                android:id="@+id/nextjobRL"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/sectionBTN"
                android:layout_marginTop="@dimen/nextjob_rl_margintop" >

                <ImageView
                    android:id="@+id/jobsectionbackgroundIMG"
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/jobsection_background_img_height"
                    android:layout_marginEnd="@dimen/jobsection_background_img_marginright"
                    android:layout_marginLeft="@dimen/jobsection_background_img_marginleft"
                    android:layout_marginRight="@dimen/jobsection_background_img_marginright"
                    android:layout_marginStart="@dimen/jobsection_background_img_marginleft"
                    android:background="@drawable/job_section_background_2x"
                    android:contentDescription="@string/jobsectionbackground_img" />

                <RelativeLayout
                    android:id="@+id/jobsectionRL"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="bottom" >

                    <ImageView
                        android:id="@+id/nextjobIMG"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentStart="true"
                        android:layout_alignParentTop="true"
                        android:layout_marginLeft="@dimen/nextjob_img_marginleft"
                        android:layout_marginStart="@dimen/nextjob_img_marginleft"
                        android:layout_marginTop="@dimen/nextjob_img_margintop"
                        android:contentDescription="@string/nextjobIMG"
                        android:src="@drawable/orange_arrow_right" />

                    <TextView
                        android:id="@+id/nextjobTXT"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:layout_alignParentStart="true"
                        android:layout_alignParentTop="true"
                        android:layout_marginEnd="@dimen/nextjob_txt_marginright"
                        android:layout_marginLeft="@dimen/nextjob_txt_marginleft"
                        android:layout_marginRight="@dimen/nextjob_txt_marginright"
                        android:layout_marginStart="@dimen/nextjob_txt_marginleft"
                        android:layout_marginTop="@dimen/nextjob_txt_margintop"
                        android:text="@string/nextjob"
                        android:textColor="#35617d"
                        android:textSize="@dimen/nextjob_txt_size"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/nextjobTXTLBL1"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginEnd="@dimen/nextjob_txt_lbl1_marginright"
                        android:layout_marginLeft="@dimen/nextjob_txt_lbl1_marginleft"
                        android:layout_marginRight="@dimen/nextjob_txt_lbl1_marginright"
                        android:layout_marginStart="@dimen/nextjob_txt_lbl1_marginleft"
                        android:layout_marginTop="@dimen/nextjob_txt_lbl1_margintop"
                        android:text="@string/nextjob_txt_lbl1"
                        android:textColor="#35617d"
                        android:textSize="@dimen/nextjob_txt_size"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/nextjobTXTLBL2"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/nextjobTXTLBL1"
                        android:layout_marginEnd="@dimen/nextjob_txt_lbl2_marginright"
                        android:layout_marginLeft="@dimen/nextjob_txt_lbl2_marginleft"
                        android:layout_marginRight="@dimen/nextjob_txt_lbl2_marginright"
                        android:layout_marginStart="@dimen/nextjob_txt_lbl2_marginleft"
                        android:text="@string/nextjob_txt_lbl2"
                        android:textColor="#35617d"
                        android:textSize="@dimen/nextjob_txt_size"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/nextjobTXTLBL3"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/nextjobTXTLBL1"
                        android:layout_marginEnd="@dimen/nextjob_txt_lbl3_marginright"
                        android:layout_marginLeft="@dimen/nextjob_txt_lbl3_marginleft"
                        android:layout_marginRight="@dimen/nextjob_txt_lbl3_marginright"
                        android:layout_marginStart="@dimen/nextjob_txt_lbl3_marginleft"
                        android:layout_marginTop="@dimen/nextjob_txt_lbl3_margintop"
                        android:text="@string/nextjob_txt_lbl3"
                        android:textColor="#35617d"
                        android:textSize="@dimen/nextjob_txt_size"
                        android:textStyle="bold" />

                    <TextView
                        android:id="@+id/nextjobTXTLBL4"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_below="@+id/nextjobTXTLBL3"
                        android:layout_marginEnd="@dimen/nextjob_txt_lbl4_marginright"
                        android:layout_marginLeft="@dimen/nextjob_txt_lbl4_marginleft"
                        android:layout_marginRight="@dimen/nextjob_txt_lbl4_marginright"
                        android:layout_marginStart="@dimen/nextjob_txt_lbl4_marginleft"
                        android:text="@string/nextjob_txt_lbl4"
                        android:textColor="#35617d"
                        android:textSize="@dimen/nextjob_txt_size"
                        android:textStyle="bold" />

                    <ImageButton
                        android:id="@+id/detailsBTN"
                        android:layout_width="@dimen/details_btn_width"
                        android:layout_height="@dimen/details_btn_height"
                        android:layout_below="@+id/nextjobTXTLBL2"
                        android:layout_marginEnd="@dimen/details_btn_marginright"
                        android:layout_marginLeft="@dimen/details_btn_marginleft"
                        android:layout_marginRight="@dimen/details_btn_marginright"
                        android:layout_marginStart="@dimen/details_btn_marginleft"
                        android:layout_marginTop="@dimen/details_btn_margintop"
                        android:contentDescription="@string/detailsBTN_description"
                        android:src="@drawable/btn_orange_background" />

                    <TextView
                        android:id="@+id/detailsTXT"
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/details_txt_height"
                        android:layout_below="@+id/nextjobTXTLBL2"
                        android:layout_marginEnd="@dimen/details_txt_marginright"
                        android:layout_marginLeft="@dimen/details_txt_marginleft"
                        android:layout_marginRight="@dimen/details_txt_marginright"
                        android:layout_marginStart="@dimen/details_txt_marginleft"
                        android:layout_marginTop="@dimen/details_txt_margintop"
                        android:gravity="center"
                        android:text="@string/details_txt"
                        android:textColor="#ffffff"
                        android:textSize="@dimen/details_txt_size" />
                </RelativeLayout>

                <TextView
                    android:id="@+id/you_dont_currentlyTXT"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/you_dont_currently_txt_marginright"
                    android:layout_marginLeft="@dimen/you_dont_currently_txt_marginleft"
                    android:layout_marginRight="@dimen/you_dont_currently_txt_marginright"
                    android:layout_marginStart="@dimen/you_dont_currently_txt_marginleft"
                    android:layout_marginTop="@dimen/you_dont_currently_txt_margintop"
                    android:contentDescription="@string/you_dont_currently_txt_description"
                    android:text="@string/you_dont_currently_txt"
                    android:textColor="#35617d"
                    android:textSize="@dimen/you_dont_currently_txt_size" />
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/lastjobRL"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/nextjobRL"
                android:layout_marginTop="@dimen/lastjob_rl_margintop" >

                <ImageView
                    android:id="@+id/jobsectionbackgroundIMG2"
                    android:layout_width="wrap_content"
                    android:layout_height="@dimen/jobsection_background_img2_height"
                    android:layout_marginEnd="@dimen/jobsection_background_img_marginright"
                    android:layout_marginLeft="@dimen/jobsection_background_img_marginleft"
                    android:layout_marginRight="@dimen/jobsection_background_img_marginright"
                    android:layout_marginStart="@dimen/jobsection_background_img_marginleft"
                    android:background="@drawable/job_section_background_2x"
                    android:contentDescription="@string/jobsectionbackground_img" />
</RelativeLayout>


    </ScrollView>   
</LinearLayout>

任何人都可以指导如何对齐超出图形布局可见区域的视图。 由于字符限制超出,无法插入整个xml代码。

0 个答案:

没有答案