gmail应用程序的工具栏看起来类似于操作栏(甚至包括溢出菜单).它是一个蓝色条,大约是屏幕下方的1/4.见图1:
我想要的酒吧用红色箭头指出.我查看了文档,没有看到一个小部件来执行此操作.我怎么能这样做一个吧?
此外,如果您看到下面的橙色箭头,则表明此应用程序顶部和底部都有一个操作栏.我很好奇这是如何完成的,但我的主要问题是如何在屏幕上的任何地方制作类似于动作栏的工具栏.
图1是在电话上.我还包括下面的图像2和图像3,它们分别是7英寸平板电脑和10英寸平板电脑.请注意,"拆分"操作栏位于包含平板电脑视图的单个栏上.


android android-widget android-layout android-xml android-gui
I’m trying to creating a layout that contains a "SurfaceView" at the top with a horizontal toolbar that is section into 3 segments in the bottom, however my SurfaceView which contains camera preview is only the only element that is showing. Please point out the error in my layout xml or provide me the similar layout xml, Thanks.
Below is my layout & updates based on user recommendations
Attempt # 1 (RelativeLayout as root):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LayoutForPreview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" …Run Code Online (Sandbox Code Playgroud) 当我运行此代码时,会显示警告对话框,但对话框周围有一个白色边框,边框也很小.我不想要这个白色边框,我希望有90度角的真正角落.我希望你明白我想要做什么.
AlertDialog.Builder ad = new AlertDialog.Builder(this);
Button bbb=new Button(MvcnContactList.this);
ad.setView(bbb);
alertDialog = ad.create();
alertDialog.show();
Run Code Online (Sandbox Code Playgroud)

是否有任何方式来设置警报对话框,但不是文本颜色或文本大小或类似的东西...我想设置警报对话框的边框,所以设置一个主题可能是这个问题的解决方案.但我不知道要覆盖哪些属性.
谢谢,
编辑:例如这个样式覆盖textColor为00FF00,这很酷,但我应该覆盖哪个属性,使角落不圆,并删除那个白洞
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AlertDialogCustom" parent="@android:style/AlertDialog">
<item name="android:textColor">#00FF00</item>
<item name="android:typeface">monospace</item>
<item name="android:textSize">10sp</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud) 我想使用渐变填充使用画布绘制弧.怎么能实现这个?
我有一个奇怪的问题,我无法弄清楚,需要一些其他的眼睛来看.我已经动态创建了一个ProgressBar视图,除了我的Motorola Xoom之外,它还适用于各种设备和AVD.
所有屏幕截图都有它们之上的设备名称,并且从它通过ADT获得的任何内容减少了大约50%,除了Nexus 10,因为它的超高分辨率是25%.添加了ProgressBar的红色背景以用于调试目的,以显示视图在那里并且可见.我添加了左边和顶部填充以使其居中.
下面的屏幕截图从Xoom开始,它不起作用,其次是Nexus 10(AVD),Nexus 7,Galaxy Nexus和HTC Droid Incredible,展示它在其他地方工作.拍摄后我会添加我的代码.
进度条不工作!但请注意视图是可见的(我们看到红色背景).

所有这些设备上都可以看到圆圈进度.
模拟三星Nexus 10

华硕Nexus 7

三星Galaxy Nexus

HTC Droid令人难以置信

这将创建包含它的父视图:
RelativeLayout discoverListLayout = new RelativeLayout(mContext);
discoverListLayout.setLayoutParams(params);
discoverListLayout.addView(mDiscoverList);
Run Code Online (Sandbox Code Playgroud)
mDiscoverList是最终显示的列表视图.ProgressBar加载在它之上,直到加载列表.
现在创建并设置进度条.我在onGlobalLayout上设置了填充,因为否则对象的宽度和高度为0.
mDiscoverLoading = new ProgressBar(mContext);
params.height = ViewPager.LayoutParams.WRAP_CONTENT;
params.width = ViewPager.LayoutParams.WRAP_CONTENT;
mDiscoverLoading.setLayoutParams(params);
mDiscoverLoading.setIndeterminate(true);
discoverListLayout.addView(mDiscoverLoading);
ViewTreeObserver vto = mDiscoverLoading.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@SuppressWarnings("deprecation")
@Override
public void onGlobalLayout() {
if (mDiscoverList.getCount() > 0) {
processLoadedList(true);
} else {
mDiscoverLoading.setBackgroundColor(getActivity().getResources().getColor(R.color.stitchoid_red));
mDiscoverLoading.setPadding((getView().getWidth() / 2) - (mDiscoverLoading.getWidth() / 2),(getView().getHeight() / 2) …Run Code Online (Sandbox Code Playgroud) 我正在使用Nexus 4 KitKat 4.4开发并尝试添加IMMERSIVE MODE到我的游戏中.我需要glViewport正确设置屏幕高度.
以前我用过
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static int getScreenHeight() {
if (Main.m_activity == null)
return -1;
Display display = Main.m_activity.getWindowManager()
.getDefaultDisplay();
int height = -1;
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){
//width = display.getWidth(); // deprecated
height = display.getHeight(); // deprecated
}else{
Point size = new Point();
display.getSize(size);
height = size.y;
}
return height;
}
Run Code Online (Sandbox Code Playgroud)
它不会返回屏幕的真实高度IMMERSIVE MODE.
所以我开始使用来自的值
private static class Renderer implements GLSurfaceView.Renderer {
public void onSurfaceChanged(GL10 gl, int width, int height) { …Run Code Online (Sandbox Code Playgroud) 如何在扩展的DialogPreference中设置自定义样式?
public class AboutDialog extends DialogPreference {
public AboutDialog(Context oContext, AttributeSet attrs)
{
super(oContext,attrs);
//there is no such a thing like setBackground(int res_id)...
}
}
Run Code Online (Sandbox Code Playgroud)
并在xml中
<com.pak1.pak.About
android:key="key" android:title="@string/preferences_about"
android:dialogTitle="@string/preferences_about_title"
android:dialogIcon="@drawable/app_icon" android:negativeButtonText="@null"
android:positiveButtonText="@string/ok" />
Run Code Online (Sandbox Code Playgroud)
或者例如是否可以更改按钮的属性?
我有一个ok按钮,例如我想改变这个'ok'按钮的颜色,我该怎么做?
是否可以定义GUI元素宽度,android:layout_width="wrap_content"但不知何故定义最小宽度Xdp?
我有这个文本视图
<TextView android:id="@+id/name"
android:singleLine="true"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textSize="16sp"
android:layout_width="fill_parent"/>
Run Code Online (Sandbox Code Playgroud)
问题是如果文本更大,那么textview可以显示它只是停止显示它看起来像这样|some unfinished tex|我希望在这样的结尾有点,这将是更清楚的用户,这是未完成的,它显示只是文本的一部分
我更喜欢这样的东西 |Some unfinished te..|
怎么实现这个?
我有一个布局,我用于行中的行ListView.在某些地方,我需要以"轻"风格和某些地方"黑暗"来展示布局.如何使用Android样式,主题等完成此操作?
我理解风格的概念,但似乎它们只适用于单个元素.他们让我定义一组属性,这些属性应用于具有样式的元素.我想要做的是定义以下属性:
TextView1)TextView2)如果我的WebView太大,我没有问题,即使内容如此之大,WebView高度也适合屏幕高度我可以滚动WebView的内容.但是如果WebView的内容很少,则WebView高度不适合屏幕.
这是我的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true">
<WebView android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true" />
</ScrollView>
<LinearLayout android:id="@+id/media_player"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="visible">
<Button android:textStyle="bold"
android:id="@+id/ButtonPlayStop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:drawable/ic_media_play" />
<SeekBar android:id="@+id/SeekBar"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_below="@id/ButtonPlayStop" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是截图:

任何人都可以帮我解决这个问题?
当隐藏软键盘时,这是我的应用程序
但是当显示键盘时,顶部的edittext框就消失了(它是向上推的).
它看起来像这样.
我的问题是如何在键盘显示时保持两个编辑框可见?我只想减少编辑框之间的空间......但两个框都可见
到目前为止我的布局是这样的
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:id="@+id/relativeLayout1">
<EditText android:id="@+id/editText1" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_width="fill_parent">
<requestFocus></requestFocus>
</EditText>
<EditText android:id="@+id/editText2" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_width="fill_parent"></EditText>
<ImageView android:id="@+id/imageView1"
android:layout_height="wrap_content" android:layout_below="@id/editText1"
android:layout_above="@id/editText2" android:background="@drawable/icon"
android:layout_width="fill_parent"></ImageView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我想写一个这样的函数
public boolean isThisScreenWithHdpiDensity(){
return true/false;
}
Run Code Online (Sandbox Code Playgroud)
但我不知道如何在程序运行时计算这个
android ×13
android-gui ×13
android-ui ×3
layout ×3
android-xml ×1
coding-style ×1
dialog ×1
gradient ×1
java ×1
opengl-es ×1
screen ×1
textview ×1
themes ×1
webview ×1