刚学的android替代资源 题目大概是 一个界面在横屏和竖屏的时候都能显示完整
————————————————割割割割哥哥哥————————————
我先在res文件下建了个main 竖版的 可以显示 路径为 (res/layout/main.xml)然后 按照书上在res的layou-land下又建了个mian.xml 貌似是替代资源说在变竖版的时候替代 路径为(res/layout-land/main.xml)就么有反应 完全没看出来替代资源祈祷什么作用 exit在横屏的时候还是不能显示 擦擦擦擦擦擦擦
——————————————————再哥哥割割割——————————————————下面是路径为 (res/layout/main.xml)的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="30dip"
android:orientation="horizontal">
>
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center">
<TextView
android:text="@string/text_main_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="25dip"
android:textSize="24.5sp" /> <Button
android:id="@+id/continue_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/continue_label" /> <Button
android:id="@+id/new_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/new_game_label" /> <Button
android:id="@+id/about_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about_label" /> <Button
android:id="@+id/exit_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/exit_label" />
</LinearLayout>
</LinearLayout>
然后是替代资源的代码 路径为(res/layout-land/main.xml)
<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="15dip"
android:orientation="horizontal">
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center"
android:paddingLeft="20dip"
android:paddingRight="20dip">
<TextView
android:text="@string/text_main_title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dip"
android:textSize="24.5sp" />
<TableLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:stretchColumns="*">
<TableRow>
<Button
android:id="@id/continue_button"
android:text="@string/continue_label"/>
<Button
android:id="@id/new_button"
android:text="@string/new_game_label"/>
</TableRow>
<TableRow>
<Button
android:id="@id/about_button"
android:text="@string/about_label"/>
<Button
android:id="@id/exit_button"
android:text="@string/exit_label"/>
</TableRow>
</TableLayout>
</LinearLayout>
</ProgressBar>最后写了替代文件后 第一个文件里的第二个LinearLayout 说This LinearLayout layout or its LinearLayout parent is useless; transfer the background attribute to the
other view 貌似是表示没作用.....
他也没提示有什么错误 这个为神马呢 %>_<%!!!!!!
弱弱的问一句 怎么上图 囧
————————————————割割割割哥哥哥————————————
我先在res文件下建了个main 竖版的 可以显示 路径为 (res/layout/main.xml)然后 按照书上在res的layou-land下又建了个mian.xml 貌似是替代资源说在变竖版的时候替代 路径为(res/layout-land/main.xml)就么有反应 完全没看出来替代资源祈祷什么作用 exit在横屏的时候还是不能显示 擦擦擦擦擦擦擦
——————————————————再哥哥割割割——————————————————下面是路径为 (res/layout/main.xml)的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="30dip"
android:orientation="horizontal">
>
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center">
<TextView
android:text="@string/text_main_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="25dip"
android:textSize="24.5sp" /> <Button
android:id="@+id/continue_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/continue_label" /> <Button
android:id="@+id/new_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/new_game_label" /> <Button
android:id="@+id/about_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about_label" /> <Button
android:id="@+id/exit_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/exit_label" />
</LinearLayout>
</LinearLayout>
然后是替代资源的代码 路径为(res/layout-land/main.xml)
<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="15dip"
android:orientation="horizontal">
<LinearLayout
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center"
android:paddingLeft="20dip"
android:paddingRight="20dip">
<TextView
android:text="@string/text_main_title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dip"
android:textSize="24.5sp" />
<TableLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:stretchColumns="*">
<TableRow>
<Button
android:id="@id/continue_button"
android:text="@string/continue_label"/>
<Button
android:id="@id/new_button"
android:text="@string/new_game_label"/>
</TableRow>
<TableRow>
<Button
android:id="@id/about_button"
android:text="@string/about_label"/>
<Button
android:id="@id/exit_button"
android:text="@string/exit_label"/>
</TableRow>
</TableLayout>
</LinearLayout>
</ProgressBar>最后写了替代文件后 第一个文件里的第二个LinearLayout 说This LinearLayout layout or its LinearLayout parent is useless; transfer the background attribute to the
other view 貌似是表示没作用.....
他也没提示有什么错误 这个为神马呢 %>_<%!!!!!!
弱弱的问一句 怎么上图 囧
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货