草庐IT

graphical-layout-editor

全部标签

android - 使用 LayoutParams 在按钮上设置 layout_gravity 时出现问题

我正在向ListActivity动态添加一个按钮。如下:setContentView(R.layout.listview_singlegrey);LayoutInflaterinflater=(LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);LinearLayoutlinear=(LinearLayout)findViewById(R.id.list_comment);ButtonbtAddComment=(Button)inflater.inflate(R.layout.bt_yellow,n

Android "Add a vertical line"在 "RelativeLayout"/"Linear Layout"

我已经阅读了有关在Android中添加垂直线的其他问题,这是我的问题我能够在我的主RelativeLayout下添加一条垂直线作为“View”,但在子RelativeLayout中无法添加。垂直线的代码水平线的代码:我的结构xml:相对布局线性布局ScrollView相对布局相对布局“添加垂直线不起作用”“添加水平线有效”线性布局在这里添加垂直线可行,但不是我想要的"水平线的LinearLayout之后的“View”没有出现。我意识到我没有深入了解android布局的结构,所以有人可以向我解释它是如何工作的。完整布局: 最佳答案 您

Android:如何正确抑制 Lint 警告 - "Consider using apply()"- 在 SharedPreferences.Editor 上调用 commit() 时?

我需要commit()而不是apply()我对SharedPreferences.Editor的更改:SharedPreferencessharedPrefs=getSharedPreferences("MY_SHARED_PREFS_FILE_NAME",Context.MODE_PRIVATE);SharedPreferences.EditorsharedPrefsEditor=sharedPrefs.edit();sharedPrefsEditor.putBoolean("MY_BOOLEAN",true);sharedPrefsEditor.commit();//但是Lint给

android - 如何对从 Google Play 安装的应用使用 Layout Inspector?

我尝试将LayoutInspector用于GooglePlay中的应用。我有一个root设备,所以当我执行“显示所​​有进程”时,会显示我开发的所有正在运行的应用程序,但不会显示官方应用程序。 最佳答案 您可以使用UiAutomator2Viewer(来自androidSDK的工具){yoursdkpath}\tools\bin\uiautomatorviewer.bat此工具显示设备显示屏上可见的所有元素的完整层次结构和属性(无论正在运行哪个应用程序)。同样在“Katalonstudio”中,我们有一个名为MobileSpy的工具

android - android.graphics.Canvas 中的 drawPosText(),什么是起源?

drawPosText(char[]text,intindex,intcount,float[]pos,Paintpaint)Drawthetextinthearray,witheachcharacter'soriginspecifiedbytheposarray.有谁知道drawPosText认为“原点”的确切位置,因为您将“原点”指定为坐标对;即,它是字符的左下角,中心,什么?还有drawPosText绘制时如何计算字符高度? 最佳答案 啊,我昨天花了一大块时间在让一些文本居中!如果您左对齐,文本原点是左下角。如果您采用居中对齐

android - setContentView(R.Layout.main) vs startActivity(intent),哪个更常见?

请告诉我使用startActivity(intent)和setContentView(R.Layout.main)的区别哪个更好,应该在什么条件下使用?我想当我们想要执行任何操作时,我们使用startActivity(intent)并且只是为了移动到不同的页面,我们使用setContentView(R.Layout.main) 最佳答案 如果使用startActivity,在新Activity的onCreate中,还要设置contentView()。因此,就时间而言,setContentView本身更快,因为它不会启动新Activi

android - java.lang.NoSuchMethodError : No static method getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable; 错误

我将AndroidStudio更新到2.2,我的项目将不再构建。我的Activity的super.onCreate(savedInstanceState)给我一个错误:java.lang.NoSuchMethodError:NostaticmethodgetDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable;inclassLandroid/support/v4/content/ContextCompat;oritssuperclasses(declarationof'android.suppor

Android: java.lang.NullPointerException at android.graphics.Canvas.drawLine(Canvas.java:809) (可能与我的可绘制资源有关)

我正在尝试构建一个包含7列和每列24个TextView的subview。当我的Activity开始时出现异常,并且它在堆栈跟踪中的任何位置都没有我的包。这是24个TextView中每个View的背景可绘制资源在此之前,CPU会达到100%一两秒。我正在使用Android2.2的模拟器这是我的异常(exception)。01-2616:51:38.084:ERROR/AndroidRuntime(955):FATALEXCEPTION:main01-2616:51:38.084:ERROR/AndroidRuntime(955):java.lang.NullPointerExceptio

android - 在包 'layout_weightSum' 中找不到属性 'android' 的资源标识符

我有一个简单的LinearLayout,它在图形布局中显示良好,但是当我构建项目时,我收到此控制台错误(我在这里缺少什么?):在包“android”中找不到属性“layout_weightSum”的资源标识符这是布局: 最佳答案 改变:android:layout_weightSum="3"收件人:android:weightSum="3"此参数没有layout前缀。 关于android-在包'layout_weightSum'中找不到属性'android'的资源标识符,我们在Stack

android - Eclipse 找不到 R.layout.simple_list_item_1

我正在使用EclipseADT构建我的第一个Android项目。我尝试填充一个LIstView,为此我创建了一个ArrayAdaptor。现在,我找不到R.layout.simple_list_item_1,它应该是android提供的?我的项目中包含“Android4.3”库,我可以在android.jar/res/layout中看到“simple_list_item_1.xml”。这里有什么遗漏的提示吗? 最佳答案 请记住,大多数时候您使用的是为您自己的项目生成的R类,如果您之前在代码中使用了一些R属性并使用了自动导入,那么您代