我是android的新手.我读到了DP,但仍然感到困惑.在一个定义中,它表示-dp(与密度无关的像素):基于屏幕密度的抽象单位.在每英寸160点的显示器上,1dp = 1px.
它意味着 - 160点= 1 dp = 1 px(每个点是1个像素,对吗?)或者160个点中的1个dp = 1个点(像素)
请说明一下
我有一个非常简单的问题:
给定R.java文件中的特定资源(id,string,drawable,...),是否可以知道它在与其匹配的文件夹上具有哪些限定符?如果是这样,怎么样?
例如,如果我的设备有一个hdpi密度的屏幕,并且我在"res/drawable-hdpi"和"res/drawable-mdpi"上有相同的文件名"x.png",我将要解码此文件,我想得到的是它从res/drawable-hdpi获取文件,并通过它知道它具有hdpi密度.
当然,在这个例子中,如果文件存在于其他文件夹中,但不存在于hdpi文件夹中,我希望它告诉我在解码文件时将使用哪个文件.
其余的限定符也是如此(locale,screenSize,...).
在Photoshop文件中,字体大小为20px.在Android中有什么sp?它是一样的,即20px = 20sp还是其他什么?
开发人员要求sp不是px.如何在Photoshop中了解或定义sp?
当我在智能手机上做应用程序时,我定义(例如)一个20px*20px的图标.这个图标在我的手机屏幕上看起来很棒,但不适用于大屏幕的平板电脑(如ipad pro).在这种情况下,图标看起来很小.
如果我按比例增加屏幕图标的大小,那么图标最终看起来太大了.举个例子:
有人知道设置图标/字体/等大小的好规则.根据屏幕的大小?我在delphi下(firemonkey)
如何在Android ListView中创建列?我有这个列表项布局xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal">
<TextView android:layout_weight=".3" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:id="@+id/hour"
android:gravity="center" />
<ImageView android:id="@+id/symbol" android:scaleType="fitCenter"
android:layout_gravity="center_horizontal" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight=".5" />
<TextView android:layout_weight=".8" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:id="@+id/temperature"
android:gravity="center" />
<TextView android:layout_weight="1" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:id="@+id/percipitation"
android:gravity="center" />
<TextView android:layout_weight="1" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:id="@+id/wind_speed"
android:gravity="center" />
<TextView android:layout_weight="1" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:id="@+id/wind_direction"
android:gravity="center" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
问题是f.ex. wind_direction从"4"变为"300",然后列不对齐.
问题http://img185.imageshack.us/img185/2812/deviceo.png
谁可以用固定宽度的列制作并使用与设备无关的整个宽度?
我们刚刚开始Android平板电脑开发.我需要为7英寸和10英寸平板电脑制作原型.
我能抓住任何线框模板吗?
我需要开始设计的画布有哪些尺寸?
我想避免用户对字体的设置首选项影响我的应用程序中各种TextView等的字体大小.
什么是最好的方法?
我无法使用下面的代码更改微调器的文本大小或颜色:
<Spinner
android:id="@+id/spinner1"
style="@style/submitspinner"
android:layout_weight="2"
android:entries="@array/a_code"
android:prompt="@string/p_code" />
Run Code Online (Sandbox Code Playgroud)
样式:
<style name="submitspinner" parent="@android:TextAppearance.Widget.TextView.SpinnerItem">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_margin">10sp</item>
<item name="android:textColor">@android:color/holo_blue_dark</item>
<item name="android:textSize">@dimen/pt</item>
</style>
Run Code Online (Sandbox Code Playgroud)
它看起来一样,如何增加文本大小并改变微调器的颜色?
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="10"
android:layout_alignBottom="@+id/editText2"
android:layout_alignRight="@+id/editText2"
android:layout_alignEnd="@+id/editText2"
android:layout_marginBottom="63dp"
android:text="@string/hello" />
Run Code Online (Sandbox Code Playgroud)
每当我输入没有字符串的文本时,它会给我一个黄色的符号.所以我做了一个字符串.现在我在layout_height上得到了上面的消息.我是android开发的新手.
我试图设置类似于旧的Facebook评论部分的弹出窗口.
圆角对话框,但我现在面临一个问题,size of dialog box和showatlocation对话框.
当我在不同的手机上尝试此代码时:
val display = windowManager.defaultDisplay
val size = Point()
display.getSize(size)
val popupWindow = PopupWindow(customView, size.x-30, size.y-300, true)
popupWindow.showAtLocation(linearLayout1, Gravity.CENTER, -3, 100)
popupWindow.setAnimationStyle(R.style.PopupAnimation)
Run Code Online (Sandbox Code Playgroud)
Xml文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/dialog_bg"
android:gravity="center"
android:orientation="vertical"
android:padding="10px">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/popup_rcv"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/new_comment_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Please enter Comment" />
<Button
android:id="@+id/comment_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
//来自Source的动画
在一个加号我的动画也禁用当我将.showAtLocation更改为其他数字
联想K8输出注:
在K8中,如果我更改为另一个值,则弹出窗口的位置会发生变化.
先感谢您.
android ×10
delphi ×1
firemonkey ×1
fonts ×1
integer ×1
ios ×1
kotlin ×1
listview ×1
photoshop ×1
popupwindow ×1
qualifiers ×1
styles ×1
types ×1