【问题标题】:Android Layout Within Layout Design布局设计中的 Android 布局
【发布时间】:2012-03-13 09:41:50
【问题描述】:

我需要制作一个与此布局设计相同的应用程序(此页面上的第一张图片)http://developer.android.com/resources/articles/speech-input.html ..

我不知道如何完成这个任务..

在此先感谢.. =)

【问题讨论】:

  • 你试过什么?你读过this doc吗?
  • 你熟悉android设计基础吗?
  • @Kabuko 先生,我知道布局的不同之处:) .. 我没有仔细阅读,但我知道..
  • @Keyhan Sir Basics 一个复杂的词..我知道每个布局工作的概念锄头..
  • 好的,我想知道你所说的“相同的布局设计”是什么意思。例如,您想知道对话框如何透明而没有标题栏,或者您的目的是关于元素如何彼此相邻。我只是想“确切地”知道你的意思:)

标签: android android-layout


【解决方案1】:

您可以使用自定义对话框进行此操作以获取更多帮助,请转到 custom dialog example

或根据您的要求

这是你的主要 XML

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

</LinearLayout>

而java文件是

package com.chirag;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;


public class TestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Dialog dialog = new Dialog(TestActivity.this);
            dialog.setContentView(R.layout.dialog_layout);
            dialog.setCancelable(true);
            //there are a lot of settings, for dialog, check them all out!


            //now that the dialog is set up, it's time to show it    
            dialog.show();
   }
}

我希望它现在对你有用...

【讨论】:

  • 先生,如果您是我发布的链接.. 下面的布局没有按钮或其他东西.. 我想在应用程序启动时显示这两种布局...跨度>
  • 意味着您希望在应用程序启动时出现该对话框,因此您必须将背景图像设置为根布局并直接在 onCreate() 方法中显示此对话框......因为没有 Activity 你可以' t 显示您的对话框....我根据您的要求编辑了我的答案...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多